Skip to content

Instantly share code, notes, and snippets.

@aashish
Last active January 31, 2018 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aashish/4bd958e9d3da8a9b4d6ebbc104cb3c29 to your computer and use it in GitHub Desktop.
Save aashish/4bd958e9d3da8a9b4d6ebbc104cb3c29 to your computer and use it in GitHub Desktop.
ElasticSearch with Neo4j

ElasticSearch with Neo4j Example test

Configured ElasticSearch with Neo4j as per demo app Search results are not as expected. Search results of ElasticSearch are different with Neo4j.

Example:

After starting and configuring ElasticSearch and Neo4j

Add the following data to Neo4j DB at http://0.0.0.0:7474/browser/

CREATE (:User {name:'Carrie-Anne Moss', born:1967})
CREATE (:User {name:'Laurence Fishburne', born:1961})
CREATE (:User {name:'Hugo Weaving', born:1960})
CREATE (:User {name:'Andy Wachowski', born:1967})
CREATE (:User {name:'Lana Wachowski', born:1965})
CREATE (:User {name:'Joel Silver', born:1952})

Neo4j search query:

MATCH (u:User {name: "Lana Wachowski"}) RETURN u

result:

born	1965
name	Lana Wachowski

ElasticSearch result is different for same search query

curl -XGET 'http://localhost:9200/neo4j-index/_search?pretty' -d '{
  "size": 3,
  "query" : {
      "bool": {
        "should": [{"match": {"name": "Andy Wachowski"}}]
      }
  }
}'

result:

{
  "took" : 3,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : 0,
    "max_score" : null,
    "hits" : [ ]
  }
}

Expected 1 result, but returned 0.

Not sure what is wrong!!

@aashish
Copy link
Author

aashish commented Jan 31, 2018

@ikwattro @espiegelberg
Can you help with above search results?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment