partitionKey - clusteringKey

パーティション・キーまたはクラスター化キーを定義する方法。

構文

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

説明

partitionKeyとclusteringKeyを使用して、vertexLabelとともにcustomer vertex idを指定します。partitionKeyはパーティション・キーを設定します。partitionKey項目を連結することによって、複合パーティション・キーを設定することもできます。clusteringKeyはクラスター化キーを設定します。使用する前にプロパティ・キーを作成する必要があります。

propertyKey city_idを作成します。
schema.propertyKey('city_id').Int().create()
パーティション分割キーとしてsensor_idを使用してvertexLabelを作成します。
schema().vertexLabel('FridgeSensor').partitionKey('sensor_id').create()
カスタム・パーティション分割キーcity_idとクラスター化キーsensor_idを持つ頂点ラベルを作成します。
schema().vertexLabel('FridgeSensor').partitionKey('city_id').clusteringKey('sensor_id').create()
city_idをパーティション分割キーとして、sensor_idをクラスター化キーとして使用して頂点を作成します。プロパティ・キーsensor_idはすでに存在し、UUIDでなければなりません。
graph.addVertex(label, 'FridgeSensor', 'city_id', 100, 'sensor_id', '60bcae02-f6e5-11e5-9ce9-5e5517507c66')
city_idsensor_idを複合パーティション分割キーとして使用してvertexLabelを作成します。
schema().vertexLabel('FridgeSensor').partitionKey('city_id', 'sensor_id').create()