final JanusGraphManagement management = getJanusGraph().openManagement();management.makePropertyKey("custID").dataType(Long.class).make();management.makeVertexLabel("PPAccount").make();management.buildIndex("PPAccountIDIndex", Vertex.class).addKey(management.getPropertyKey("custID")).buildCompositeIndex();management.commit();final Vertex bruceLi = g.addV("Account").property("custID", 11L).next();g.tx().commit();
ManagementSystem.awaitGraphIndexStatus((JanusGraph) graph, "AccountIDIndex").call();
// look up vertex by name can use a composite index in JanusGraphTraversal<Vertex, Map<Object, Object>> traversal = g.V().has("custID", 11L).valueMap();
while (traversal.hasNext()) { Object result = traversal.next(); LOGGER.info(result.toString());}10:31:30 WARN org.janusgraph.graphdb.transaction.StandardJanusGraphTx - Query requires iterating over all vertices [(custID = 11)]. For better performance, use indexes
--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/685b7216-498d-4f54-a403-8388e3e16d1f%40googlegroups.com.
Hi Junsheng,
I am using Janusgraph since a year, here is a best practice I can suggest if you are working with indexes.
Before adding any vertex into janusgraph first create indexes.
If you have already added data change the keyspace name if you are using cassandra. Or delete every data from backend don't use g.V().drop(). Directly delete from backend.
Then start with creating indexes first after then only start adding data.
Hope this helps.
Thanks,
Abhay
To unsubscribe from this group and stop receiving emails from it, send an email to janusgra...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/51dbc512-7211-43bb-a534-cb0ad6b5a976%40googlegroups.com.