Last active
August 1, 2018 04:53
-
-
Save NhuanTDBK/999bc2b8773c1076c1ab6241d4bfb2e1 to your computer and use it in GitHub Desktop.
janusgraph_index
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
graph = JanusGraphFactory.open("conf/gremlin-server/janusgraph-cql-es.properties") | |
mgmt = graph.openManagement() | |
mgmt.makePropertyKey("shop_id").dataType(Long.class).cardinality(Cardinality.SINGLE).make() | |
mgmt.makePropertyKey("ref_id").dataType(Long.class).cardinality(Cardinality.SINGLE).make() | |
mgmt.commit() | |
mgmt = graph.openManagement() | |
shopID = mgmt.getPropertyKey("shop_id") | |
refId = mgmt.getPropertyKey("ref_id") | |
mgmt.buildIndex("ByShopID",Vertex.class).addKey(shopID).buildCompositeIndex() | |
mgmt.buildIndex("ByShopIDAndRefID",Vertex.class).addKey(shopID).addKey(refId).unique().buildCompositeIndex() | |
mgmt.commit() | |
System.out.println("Indexing is created") | |
ManagementSystem.awaitGraphIndexStatus(graph,"ByShopID").call() | |
ManagementSystem.awaitGraphIndexStatus(graph,"ByShopIDAndRefID").call() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment