partitionKey - clusteringKey


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


partitionKey and clusteringKey are used to specify a customer 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()

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000,