Indexes
Couchbase Server uses indexes to improve the performance of queries and searches. Each index makes a specific subset of data available for searching.
The Query Service uses indexes from the Index Service. The Search and Analytics Services create and use their own indexes.
Couchbase Server supports two classes of indexes: Traditional Indexes and Vector Indexes.
Traditional Indexes
You can use the following types of indexes for traditional scalar data:
- Primary
-
The Index Service provides primary indexes based on the unique key of each item in a collection. Couchbase Server maintains every primary index asynchronously. Use a primary index for basic queries without filters or predicates. For more information about primary indexes, see Primary and Secondary Index Reference.
- Secondary
-
The Index Service provides secondary indexes based on attributes in a document. The attribute value can be a scalar, object, or array.
A secondary index is also called a Global Secondary Index (GSI). Most queries in Couchbase Server use GSIs with SQL++. For more information about Global Secondary Indexes, see Primary and Secondary Index Reference.
- Search
-
The Search Service provides Search indexes that support text matching, geospatial, date-time, and numeric range searches. For text matching, you can add filters to remove unwanted characters from input and target text, such as punctuation marks or HTML tags. For more information about creating Search indexes, see Create a Search Index.
- Analytics
-
The Analytics Service provides analytics indexes for shadow data in an Analytics collection. Analytics indexes speed up selection and join queries in Analytics. When operational data changes, Couchbase Server updates analytics indexes automatically. For more information about using analytics indexes, see Using Indexes.
- Views
-
Couchbase Views extract fields and information from documents to create their own index.
Views were deprecated in Couchbase Server 7.0 and will be removed in a future release.
Vector Indexes
Couchbase Server also supports indexes for vector search. These indexes let you perform semantic similarity searches that form the basis of AI applications. See vector-index/vectors-and-indexes-overview.adoc for more information about using vector indexes.
- Hyperscale Vector Indexes
-
The Index Service provides Hyperscale Vector Indexes which index a single vector column. They offer the highest performance of any index when it comes to vector data. These indexes can scale up to a billion documents containing vectors with a large number of dimensions.
- Composite Vector Indexes
-
The Index Service provides Composite Vector Indexes which are Global Secondary Indexes (GSIs) with a single vector column. These indexes let your application use searches for scalar, array, and object index entries to pre-filter the dataset before performing a vector similarity search.
- Search Vector Indexes
-
The Search Service provides Search Vector Indexes that support a single vector column. You can use Search Vector Indexes for tasks such as Retrieval Augmented Generation (RAG) with a Large Language Model (LLM).