This page shows you how to create a serverless index, pod-based index, and an index from a collection.

To learn about the concepts related to indexes, see Understanding indexes.

Create a serverless index

To create a serverless index, use the spec parameter to define the cloud and region where the index should be deployed. For Python, you also need to import the ServerlessSpec class.

Serverless indexes are in general availability on AWS and in public preview on GCP and Azure. Check the serverless limits and restrictions.

Create a pod-based index

To create a pod-based index, import the PodSpec class and use the spec parameter to define the environment where the index should be deployed, the pod type and size to use, and other index characteristics:

For the full list of parameters available to customize an index, see the create_index API reference.

Create an index from a collection

Serverless indexes can be created only from collections for pod-based indexes. For more details, see Migrate a pod-based index to serverless.

To create a pod-based index from a collection, use the create_index operation and provide a source_collection parameter containing the name of the collection from which you wish to create an index. The new index is queryable and writable.

Creating an index from a collection generally takes about 10 minutes. Creating a p2 index from a collection can take several hours when the number of vectors is on the order of 1M.

Example

The following example creates an index named example-index with 128 dimensions from a collection named example-collection.