JanusGraphJ
JanusGraph3y ago
6 replies
WhiteDeath

How to create, register and enable an index in Janusgraph?

I want to create an index to find a vertex by label and a property value.

I saw from documentation that i have to Install->Register->Enable the index, but somehow i can't get it to be Register and Enabled.

1) Install

JanusGraph graph_joy = JanusGraphFactory
  .open("/home/white/IdeaProjects/squery-gremlin/conf/janusgraph.properties");

JanusGraphManagement mgmt = graph_joy.openManagement();
mgmt.buildIndex("indexID_05", Vertex.class)
     .indexOnly(mgmt.getVertexLabel("user"))
     .addKey(mgmt.getPropertyKey("userid")).buildCompositeIndex();

mgmt.commit();   
//timeouts see bellow the logs
ManagementSystem.awaitGraphIndexStatus(graph_joy,"indexID_05").call();   


Graph Index | Type        | Unique    | Backing        | Key:           Status |
indexID_05  | Composite   | false     | internalindex  | userid:     INSTALLED |

2) Register? Enable?

mgmt = graph_joy.openManagement();
ManagementSystem.awaitGraphIndexStatus(graph_joy,"indexID_05").call();
mgmt.updateIndex(mgmt.getGraphIndex("indexID_05"), SchemaAction.REGISTER_INDEX).get();
mgmt.commit();


Didn't work, still remains just installed, i tried enable also, and it said to register first, get from logs a timeout on the awaitGraphIndexStatus();
.....
23-06-06 16:29:05 death INFO [org.janusgraph.graphdb.database.management.GraphIndexStatusWatcher:82] - Some key(s) on index indexID_05 do not currently have status(es) [REGISTERED]: userid=INSTALLED
23-06-06 16:29:05 death INFO [org.janusgraph.graphdb.database.management.GraphIndexStatusWatcher:82] - Some key(s) on index indexID_05 do not currently have status(es) [REGISTERED]: userid=INSTALLED
23-06-06 16:29:05 death INFO [org.janusgraph.graphdb.database.management.GraphIndexStatusWatcher:91] - Timed out (PT1M) while waiting for index indexID_05 to converge on status(es) [REGISTERED]


If someone can give a simple example of how to install->register->enable an index it will help i am stuck.
Was this page helpful?