0

I have a Titan graph with ES backend and DynamoDB for persistence.

Method has("mykey", "value") never retrieves a vertex. it always return nothing when querying for a mykey which is indexed by Elasticsearch. The index is updated and enabled.

WHen running this query,

gremlin>  graph.indexQuery("verticesIndex2", "v.mykey:myvalue").vertices().asList().size()
==>1  // It works here!! The vertex is retrieved successfully.
gremlin> g.V().has("mykey", "myvalue").hasNext()
==>false // doesn't retrieve anything!!!
gremlin> g.V(16998408).values("mykey")
==>myvalue // the vertex exists in my graph for sure !!

I tried a trick to make it work

gremlin> g.V().has("mykey").has("mykey", "myvalue").next() 
19:49:44 WARN  com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx  - Query requires iterating over all vertices [()]. For better performance, use indexes
==>v[16998408] // It works !!

This seems to be an issue somewhere, but not sure where exactly. Any thoughts on this?

Mohamed Taher Alrefaie
  • 15,698
  • 9
  • 48
  • 66

2 Answers2

0

I'm having a similar issue with a lucene index - including the same index usage symptoms.

Note that in the query that doesn't retrieve anything, it also doesn't complain about the lack of an index. But in the query that does, it complains about having to iterate over all vertices.

I suspect it's the index that is failing - that the simple has("...") operation first requires a non-index search, so is succeeding, but every time an index search is used, that is failing.

Nathan Kronenfeld
  • 473
  • 1
  • 5
  • 14
0

I'm using ES and HBase, and I'm having the same question.

when I build a mixed index using ES for a String type, when querying with soming thing like

g.V().has("mykey", "myvalue").hasNext()

it warns me that I'm not using indexes, and querys rather slow.

But when I build a mixed index using ES for a Integer type, and querying like

g.V().has("myInt", "myIntValue").hasNext()

it warns nothing and querys rather fast.

So now I use compositeIndex for String types to avoid this

ziploe
  • 1
  • 1