I am trying out the Custom Vertex ID feature in JanusGraph as mentioned in the below documentation
https://docs.janusgraph.org/master/advanced-topics/custom-vertex-id/
I am using Cassandra as the backend store for the JanusGraph database and used the below properties for enabling the custom vertex Id feature in Janus Graph, Currently I am using Embedded JanusGraph with Java Code.
storage.cql.keyspace=janusgraph
graph.set-vertex-id=true
graph.allow-custom-vid-types=true
When I try with an existing keyspace where existing records are already present I am getting the below exception
Exception in thread "main" java.lang.UnsupportedOperationException: Vertex does not support user supplied identifiers
at org.apache.tinkerpop.gremlin.structure.Vertex$Exceptions.userSuppliedIdsNotSupported(Vertex.java:163)
at org.janusgraph.graphdb.tinkerpop.JanusGraphBlueprintsTransaction.addVertex(JanusGraphBlueprintsTransaction.java:119)
at org.janusgraph.graphdb.tinkerpop.JanusGraphBlueprintsGraph.addVertex(JanusGraphBlueprintsGraph.java:143)
But once I try the same code on a new Cassandra Key space it is working as expected and able to store the string Custom Vertex Ids using the below Code
Vertex firstVertex = g.addV("record")
.property(T.id,"customVertexId1")
.property("recordId", "abc")
.next();
So my query is this Custom Vertex Id cannot be applied to existing Keyspaces? We always require to create the new keyspaces for using the Custom String type vertexId in JanusGraph? Please Suggest
See https://docs.janusgraph.org/advanced-topics/custom-vertex-id/#alter-an-existing-graph
Basically if you want to use this on an existing graph, you should do
mgmt = graph.openManagement();
mgmt.set("graph.set-vertex-id", true);
// optional, if you want to provide string ID
mgmt.set("graph.allow-custom-vid-types", true);
mgmt.commit();