Creating Indexes In JanusGraph
How do you create indices in JanusGraph and/or Gremlin with Java?
JanusGraph still isn't using the index provided.
10 Replies
there's lots of information about this message in mailing lists, stackoverflow and other resources, but the one that comes to me readily is the one i think i pointed you at already: https://stackoverflow.com/a/49966807/1831717 you simply aren't using the index when you do
hasLabel()
because, as good ol' Jason Plurad wrote in that post, your query:
requires a full vertex scan because JanusGraph does not currently allow you to create an index on vertex label.For an index to be used you can't just filter on
T.label
. You need to include a property key and value as well for the index to be engaged.Stack Overflow
Janusgraph - WARNING about iterating over all vertices after schema...
I am using JanusGraph with Cassandra and ElasticSearch backends. I have used the following script to create my schema and indexes.
// Create a Janus Graph instance, according to the configuration...
Thank you
have you given it a try? like, do:
g.V().has('entity', "_id", 123)
- does the warning go away?inmemory
doesn't get the issue. But switching it back to just JanusGraphFactory.build().set("storage.backend", "cql").set("storage.hostname", "localhost:9042").open();
breaks it all over againi believe different backends have different properties, so i think that could be expected
yeah...so, it's basically working as expected
JanusGraph blows up when I just switch the JanusGraphFactory
this is a separate issue though from what you were asking about though right? do you understand why you are getting this warning now: "Query requires iterating over all vertices [[~label = entity, _id <> null]]. For better performance, use indexes"?e
Yup! Thanks