Dark Mode

Create an index

Prerequisites

Use the application token you generatedto create schema in your keyspace using the GraphQL playground.

Tables can contain partition keys and clustering keys, both of which define theprimary key. A table can also include non-primary keys.

If you wish to create a table query that uses anything other than the partition keyto define which row or rows are to be retrieved, a column index must be createdon each column in order to read the data.

Currently, those indexes can be created withCQLor GraphQL.

Use the application token you generatedto create schema in your keyspace using the GraphQL playground.

You can create an index using a mutation in /graphql-schema .In the following example, three indexes are created for the tables book and reader .The table columns for these indexes are created are author , birthdate , and email .

An index name can be defined, such as author_idx in this example.An additional option, indexType can be defined to use SAI indexes if desired.

Here is an additional example, which creates indexes that could be used in the REST API examples:

The CQL commands for creating these indexes is included here for reference.The cqlsh tool can be used to create the indexes if desired.