graphaware / neo4j-to-elasticsearch

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

Updating node rewraps elastic document #147

Closed anttev closed 5 years ago

anttev commented 5 years ago

I have a situation when I have already indexed neo4j nodes to elastic and then I update node properties in neo4j it causes the elastic document to be re-wrapped.

So first the document looks like:

{ "_index": "folders", "_type": "folders", "_id": "35bf7310-01d2-11e9-b088-0242ac120005", "_score": 1, "_source": { "parent": 1072, "parent_folder": 1072, "keyProperty": null, "name": "folder name", "project": 1071, "created_at": "2018-12-17T08:03:17.072Z", "description": "", "folder_id": 845955, "type": "Folder", "uuid": "35bf7310-01d2-11e9-b088-0242ac120005" } } Then in neo4j I update the name property and elastic document is updated:

{ "_index": "folders", "_type": "folders", "_id": "35bf7310-01d2-11e9-b088-0242ac120005", "_score": 1, "_source": { "index": "folders", "type": "folders", "id": "35bf7310-01d2-11e9-b088-0242ac120005", "source": { "parent": 1072, "parent_folder": 1072, "keyProperty": null, "name": "updated", "project": 1071, "created_at": "2018-12-17T08:03:17.072Z", "description": "", "folder_id": 845955, "type": "Folder", "uuid": "35bf7310-01d2-11e9-b088-0242ac120005" } } } My mapping file:

{ "defaults": { "key_property": "uuid", "relationships_index": "relationship-index" }, "node_mappings": [ { "condition": "hasLabel('Folder')", "index": "folders", "type": "folders", "properties": { "keyProperty": "uuid", "name": "getProperty('name')", "project": "query('MATCH (p:Project)<-[:ROOTOF|:CHILDRENOF*]-(f:Folder) where ID(f) = {id} RETURN ID(p) AS value')", "folder_id": "query('MATCH (f:Folder) where ID(f) = {id} RETURN ID(f) AS value')", "parent_folder": "query('MATCH (f:Folder)<-[:PARENTOF]-(p:Folder) where ID(f) = {id} RETURN ID(p) AS value')" } } ......

Neo4j version 3.3.5, elastic search version: 6.3, neo4j-to-elastic plugin version: 3.3.5.52.8

ikwattro commented 5 years ago

This was fixed in 3.4.0.52.10 - Ref https://github.com/graphaware/neo4j-to-elasticsearch/issues/114

Please upgrade to the latest 3.4.x version