Create an index
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 Indexes.
Create a serverless index
Serverless indexes are in public preview and are available only on AWS in the us-west-2
, us-east-1
, and eu-west-1
regions. Check current limits and restrictions and test thoroughly before using them in production.
To create a serverless index, import the ServerlessSpec
class and use the spec
parameter to define the cloud and region where the index should be deployed:
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 do not support collections.
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
.
Was this page helpful?