Re: Index not being use


Chin Huang <chinhu...@...>
 

Please note "Graph indexes built against newly defined property keys, i.e. property keys that are defined in the same management transaction as the index, are immediately available. Graph indexes built against property keys that are already in use require the execution of a reindex procedure to ensure that the index contains all previously added elements. Until the reindex procedure has completed, the index will not be available." from http://docs.janusgraph.org/latest/indexes.html

You might want to go through the reindex procedure.

On Fri, Aug 11, 2017 at 1:24 PM, Rohit Jain <rohit.j...@...> wrote:
Hi folks,

So I created an index like so:

gremlin> graph.tx().rollback()
==>null
gremlin> mgmt = graph.openManagement()
==>org.janusgraph.graphdb.database.management.ManagementSystem@6843fdc4
gremlin> personid = mgmt.getPropertyKey('personid')
==>personid
gremlin> mgmt.buildIndex('personid', Vertex.class).addKey(personid).unique().buildCompositeIndex()
==>personid
gremlin> mgmt.commit()
==>null

Then I do a query like so, and it gives me a warning that I should use indexes.  Isn't the index use not implicit?  Do I have to do anything specific for it to use the index I just created?

gremlin> g.V().has('personid','640').out('role').inE('role').has('roletype',eq("director")).outV().values('personid')
13:14:45 WARN  org.janusgraph.graphdb.transaction.StandardJanusGraphTx  - Query requires iterating over all vertices [(personid = 640)]. For better performance, use indexes
==>7735

Rohit

--
You received this message because you are subscribed to the Google Groups "JanusGraph users list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Join janusgraph-users@lists.lfaidata.foundation to automatically receive all group messages.