Ankit Bansal
Ankit Bansal

Reputation: 2358

Neo4j Elastic Search Integration

I have data set(questions) which are mapped to multiple tags and these tags are hierarchical in nature. So there is A question which is mapped to t1 and t2 tag. t1 has parent p1 and p1 has parent p2.(p2 -> p1 - >t1 --mapped to--->A)

So i was storing my data in neo4j and I want to get A as result for p2 tag. I am getting result easily using cypher. but now i have sort and limit by in the same query and since neo4j cant use index in such queries, i am thinking of integrating neo4j with elasticsearch, but I am not able to get how to query?

$query = "MATCH p=(n:messages)-[r:TAGGED_TO]->(k:tags{tag_id:{tag_id}}) RETURN p,n ORDER by n.msgId desc limit 5";
$params['tag_id'] = (int)$tag_id;
$result = $this->dbHandle->run($query,$params);

Now sort and limit are not using index. I want to run this query in optimized way.

Upvotes: 0

Views: 160

Answers (1)

Tomaž Bratanič
Tomaž Bratanič

Reputation: 6534

You can use Graphaware plugin for connecting neo4j to elastic or the apoc plugin,specifically apoc.es.* functions... see documentation for more.

Upvotes: 0

Related Questions