Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JanusGraph with Elasticsearch index is not working

I have added mixed index in JanusGraph to support full-text search with Elasticsearch.

I have mixed index like:

myindex = mgmt.buildIndex("myesindex", Vertex.class)
    .addKey("name", Mapping.TEXTSTRING.asParameter())
    .addKey("sabindex", Mapping.TEXTSTRING.asParameter())
    .buildMixedIndex("search");

I am able to load data into Elasticsearch engine. Also I am able to execute the query successfully.

The issue I am facing is when I hit query :

g.V().has('code','abc').valueMap()
==>{str=[some text], code=[abc], sab=[sab], sabindex=[sabindex], name=[[some tex]]}

I am getting the result successfully, but when I try to search with name and code:

g.V().has('name', textContains('some text')).has('code','abc').valueMap()

code field is also indexed(composite)

At that time I am getting no result. Though data is present in graph and Elasticsearch.

And another scenario is same query with different name and code works successfully. I also rebuild the graph multiple times but not getting positive results.

like image 248
Shubham Parikh Avatar asked Oct 16 '25 04:10

Shubham Parikh


1 Answers

The first query shows the value is name=[[some tex]]. It is missing the final t in text, so that explains why the query isn't matching on some text.

If you instead do textContains('some tex'), you would get the same result as the first query. Using the profile() step would show that the myindex was utilized.

See this gist of the recreate scenario.

like image 142
Jason Plurad Avatar answered Oct 18 '25 05:10

Jason Plurad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!