Re: Index on a vertex label from Java

Jason Plurad <plu...@...>

You can't create an index on a vertex label right now. See

You can create an index on a property. For example, you could define a property called "mylabel", create a composite index on it, then do g.V().has("mylabel", "foo").count().next().

On Monday, August 7, 2017 at 5:06:19 PM UTC-4, Peter Schwarz wrote:
How does one create an index on a vertex label from Java?  I want to speed up queries that retrieve or count the vertices with a  particular label, e.g. g.V().hasLabel("foo").count().next().  In Gremlin-Groovy, I think you can use getPropertyKey(T.label) to reference the key that represents a label and pass that to addKey, but this does not work in Java because getPropertyKey expects a String and T.label is an enum.  What's the right way to do this?

Join { to automatically receive all group messages.