partitionKey - clusteringKey

How to define a partition key or clustering key.


partitionKey('id_name').[ clusteringKey(('id_name') ]


partitionKey and clusteringKey are used to specify a user-defined vertex id in conjunction with vertexLabel. The partitionKey sets a partition key. A composite partition key can also be set. by chaining partitionKey items. The clusteringKey sets a clustering key. The property keys used must be created prior to use.


Create a propertyKey city_id.
Create a vertexLabel using sensor_id as a partitioning key.
Create a vertex label with a custom partitioning key city_id and clustering key sensor_id.
Create a vertex using city_id as a partitioning key and sensor_id as a clustering key. The property key sensor_id must already exist and be an UUID.
graph.addVertex(label, 'FridgeSensor', 'city_id', 100, 'sensor_id', '60bcae02-f6e5-11e5-9ce9-5e5517507c66')
Create a vertexLabel using city_id and sensor_id as a composite partitioning key.
schema().vertexLabel('FridgeSensor').partitionKey('city_id', 'sensor_id').create()