How to do indexing in Janusgraph Or Gremlin
First step :remote connect tinkerpop.server conf/remote.yaml session
Second Step :remote config timeout none
Third Step :remote console
Fourth Step graph.getOpenTransactions().size();
Fifth Step for(i=0;i<size;i++) {graph.getOpenTransactions().getAt(0).rollback()}
Note:- Replace size with output of fourth step
Sixth Step mgmt = graph.openManagement()
Seventh Step name = mgmt.getPropertyKey(‘name’)
Eighth Step bynameindex=mgmt.buildIndex(‘byNameComposite’, Vertex.class).addKey(name).buildCompositeIndex()
Ninth Step mgmt.commit();
Tenth Step ManagementSystem.awaitGraphIndexStatus(graph, “byNameComposite”).call();
Eleventh Step mgmt = graph.openManagement()
Twelfth Step mgmt.updateIndex(mgmt.getGraphIndex(“byNameComposite”), SchemaAction.REGISTER_INDEX).get();
Thirteenth Step mgmt.commit()
Fourteenth Step mgmt = graph.openManagement()
Fifteenth Step mgmt.updateIndex(mgmt.getGraphIndex(“byNameComposite”), SchemaAction.REINDEX).get()
Sixteenth Step mgmt.commit()
Seventeenth Step prop = mgmt.getPropertyKey(‘name’);
Eighteenth Step idx = mgmt.getGraphIndex(‘byNameComposite’);
Nineteenth Step status = idx.getIndexStatus(prop);
Twentieth Step print(status)
Hurray, You have enabled the property for indexing.
Now, Use it as follows.
g=graph.traversal()
g.V().property(‘name’,’Sumit’)
Now, you will get the result, before you can even blink your eyes, Even if you have billions of nodes.