Created
August 30, 2021 10:39
-
-
Save li-boxuan/d8059d1c40652c3c5308670ce383e96a to your computer and use it in GitHub Desktop.
Insert 10 million nodes into JanusGraph
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/janusgraph-cql-es.properties") | |
mgmt = graph.openManagement(); | |
name = mgmt.makePropertyKey("name").dataType(String.class).cardinality(Cardinality.SINGLE).make(); | |
mgmt.buildIndex("nameIndex", Vertex.class).addKey(name).buildCompositeIndex(); | |
age = mgmt.makePropertyKey('age').dataType(Integer.class).make() | |
mgmt.buildIndex("ageIndex", Vertex.class).addKey(age).buildMixedIndex("search") | |
mgmt.commit(); | |
v = graph.addVertex("name", "outer"); | |
for (i = 0; i < 2500; i++) { | |
otherV = graph.addVertex("name", "middle") | |
v.addEdge("connects", otherV); | |
for (j = 0; j < 4000; j++) { | |
innerV = graph.addVertex("name", "inner" + (j % 50), "age", j % 100); | |
otherV.addEdge("connects", innerV); | |
} | |
graph.tx().commit(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment