index - vertex index

Synopsis

index('index_name').[secondary() | materialized() | search()].by('propertykey_name').[ asText() | asString() ].add()

Description

A vertex index specifies an index that is built using a vertex property key in DSE Graph. A vertex label must be specified. Vertex indexes can be specified as secondary, materialized, or search. The index name must be unique.

A search vertex index must be named search; only one search index can exist. Multiple property keys can be specified in a single search index definition. The options asText() and asString() must be specified for a search index.

Examples

Create an index byRecipe as a secondary index using the property key name The vertex label is specified as recipe.

schema.vertexLabel('recipe').index('byRecipe').secondary().by('name').add()

Create an index byMeal as a materialized index using the property key name. The vertex label is specified as meal.

schema.vertexLabel('meal').index('byMeal').materialized().by('name').add()

Create an index search as a search index using the property key instructions and specify that the index is a asText(). The vertex label is specified as recipe.

schema.vertexLabel('recipe').index('search').search().by('instructions').asText().add()

Create an index search as a search index using multiple property keys instructions with asText() and category with asString(). The vertex label is specified as recipe.

schema.vertexLabel('recipe').index('search').search().by('instructions').asText().by('category').asString().add()

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, info@datastax.com