graphaware / neo4j-to-elasticsearch

GraphAware Framework Module for Integrating Neo4j with Elasticsearch
261 stars 57 forks source link

Elasticsearch 6.2: Rejected mapping #122

Closed TobiasLeo closed 6 years ago

TobiasLeo commented 6 years ago

First off, this is not a problem in versions of Elasticsearch prior to version 6.

Problem: With only one label in the Neo4j database automatic indexing with Elasticsearch works well and creates a proper mapping for it and any subsequent properties, but once more labels are added it fails to add anything more to any Elasticsearch indices or create Mappings for other labels. This error shows up in the log (full stacktrace at the bottom of the issue): java.lang.IllegalArgumentException: Rejecting mapping update to [neo4j-index-node] as the final mapping would have more than 1 type: [LabelA, LabelB]

Since there are changes to indices from Elasticsearch 6 (can only have a single type) I am curious about if neo4j-to-elasticserach is supposed to be able to work with it.

Question: Is there any configuration or work-around that can be used to circumvent these mapping problems?

Applications:

Elasticsearch version: 6.2 
Neo4j version: 3.3

Plugins:

graphaware-neo4j-to-elasticsearch-3.3.5.52.8
graphaware-server-enterprise-all-3.3.5.52
graphaware-uuid-3.3.5.52.17

Config

com.graphaware.module.UIDM.1=com.graphaware.module.uuid.UuidBootstrapper
com.graphaware.runtime.enabled=true
com.graphaware.module.UIDM.initializeUntil=0
com.graphaware.module.ES.2=com.graphaware.module.es.ElasticSearchModuleBootstrapper
com.graphaware.module.ES.uri=localhost
com.graphaware.module.ES.port=9200

Error in log:

[2018-06-14T14:51:10,586][DEBUG][o.e.a.b.TransportShardBulkAction] [neo4j-index-node][1] failed to execute bulk item (index) BulkShardRequest [[neo4j-index-node][1]] containing [index {[neo4j-index-node][Incident][9ccd7a40-6fd1-11e8-b7bb-0a0027000007], source[{}]}]
java.lang.IllegalArgumentException: Rejecting mapping update to [neo4j-index-node] as the final mapping would have more than 1 type: [LabelA, LabelB]
        at org.elasticsearch.index.mapper.MapperService.internalMerge(MapperService.java:501) ~[elasticsearch-6.2.0.jar:6.2.0]
        at org.elasticsearch.index.mapper.MapperService.internalMerge(MapperService.java:353) ~[elasticsearch-6.2.0.jar:6.2.0]
        at org.elasticsearch.index.mapper.MapperService.merge(MapperService.java:285) ~[elasticsearch-6.2.0.jar:6.2.0]
        at org.elasticsearch.cluster.metadata.MetaDataMappingService$PutMappingExecutor.applyRequest(MetaDataMappingService.java:313) ~[elasticsearch-6.2.0.jar:6.2.0]
        at org.elasticsearch.cluster.metadata.MetaDataMappingService$PutMappingExecutor.execute(MetaDataMappingService.java:230) ~[elasticsearch-6.2.0.jar:6.2.0]
        at org.elasticsearch.cluster.service.MasterService.executeTasks(MasterService.java:643) ~[elasticsearch-6.2.0.jar:6.2.0]
        at org.elasticsearch.cluster.service.MasterService.calculateTaskOutputs(MasterService.java:273) ~[elasticsearch-6.2.0.jar:6.2.0]
        at org.elasticsearch.cluster.service.MasterService.runTasks(MasterService.java:198) ~[elasticsearch-6.2.0.jar:6.2.0]
        at org.elasticsearch.cluster.service.MasterService$Batcher.run(MasterService.java:133) ~[elasticsearch-6.2.0.jar:6.2.0]
        at org.elasticsearch.cluster.service.TaskBatcher.runIfNotProcessed(TaskBatcher.java:150) ~[elasticsearch-6.2.0.jar:6.2.0]
        at org.elasticsearch.cluster.service.TaskBatcher$BatchedTask.run(TaskBatcher.java:188) ~[elasticsearch-6.2.0.jar:6.2.0]
        at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:566) ~[elasticsearch-6.2.0.jar:6.2.0]
        at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:244) ~[elasticsearch-6.2.0.jar:6.2.0]
        at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:207) ~[elasticsearch-6.2.0.jar:6.2.0]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
ikwattro commented 6 years ago

Hi @TobiasLeo You can use the JsonMapper : https://github.com/graphaware/neo4j-to-elasticsearch/blob/master/docs/json-mapper.md

Much more flexible and fits almost all the needs for the replication.

TobiasLeo commented 6 years ago

Thanks @ikwattro, that's exactly what I needed! Looks powerful enough to handle a lot of different situations and solves my issue.