graphaware / neo4j-to-elasticsearch

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

Issue in Cyher queries for replication logic in Elastic #154

Closed GaneshbabuRamamoorthy closed 3 years ago

GaneshbabuRamamoorthy commented 5 years ago

Hi All,

Using neo4j 3.5.6 & elasticsearch 6.3.2

I am tring cyher query for returning a value to be set for elastic document and below is the syntax I tried and relationship data was indexed in elasticsearch,

"relationship_mappings": [
    {
      "condition": "isType('installed')",
      "type": "relationship",
      "properties": {
        "relationship": "query('MATCH (n) WHERE id(n) = {id} MATCH (s)-[i:installed]->(h) RETURN collect({name: type(i), start_node: labels(s), end_node: labels(h)}) AS value')"
       }
    }
  ]

Below is the JSON data stored in ES and from the above mapping I am trying to get the type of relationship, startnode, endnode, but I also want to find the type of direction between the nodes whether it is incoming or outgoing. I am not able to figure it out the right way.

        "_source" : {
          "relationship" : [
            {
              "end_node" : [
                "Hardware"
              ],
              "start_node" : [
                "Software"
              ],
              "name" : "installed"
            }
          ],
          "uuid" : "d630b990-9d76-11e9-ac31-06af4f80a04c",
          "DisplayVersion" : "3.5.6"

I am stuck in relationship mapping how to get the right value and please correct me if I am doing any wrong and let me know your thoughts.

Regards, Ganeshbabu R