index - vertex index

How to add a 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()