Index Service

      The Index Service supports the creation of primary and secondary indexes on items stored within Couchbase databases. Indexes enable and enhance the performance of query operations.

      About the Index Service

      The Index Service creates indexes from predefined subsets of bucket data. The Query Service relies on indexes provided by the Index Service.

      The SQL++ query language instructs the Index Service to create indexes. The Index Service can create two types of indexes:


      Based on an attribute within a document. The value associated with the attribute can be of any type: scalar, object, or array.

      A Secondary Index is often called a Global Secondary Index, or GSI. This index is used frequently in Couchbase Server for queries performed with the SQL++ query language. The CREATE INDEX statement creates secondary indexes.


      Based on the unique key of every item in a specified bucket or collection. Every primary index is maintained asynchronously.

      A primary index is for simple queries that have no filters or predicates. The CREATE PRIMARY INDEX statement creates primary indexes.

      Couchbase Capella supports standard index storage for saving indexes. By default, an index is saved on the node where it’s created. Each index is created on one keyspace—​a bucket or collection. Multiple indexes can be created on a single keyspace.

      Using the Index Service

      Like the other Couchbase services, you can deploy the Index Service during database creation or by adding it to an existing database. The Index Service depends on the Data Service for underlying functionality and the Query Service for creating and managing indexes using the SQL++ query language. For more information about how these services interact, see Couchbase Server | Indexes.

      If a database has both the Index Service and Query Service, you can manage and monitor indexes using the Couchbase Capella UI. You can also use the Query tab to create, modify, and drop indexes using SQL++ statements.