Manage indexes

An index is the highest-level organizational unit of vector data in Pinecone. It accepts and stores vectors, serves queries over the vectors it contains, and does other vector operations over its contents. In this section, we explain how you can get a list of your indexes, create an index, delete an index, and describe an index.

warning

Indexes on the Free plan are deleted after 30 days of inactivity. To prevent this, send any API request to Pinecone or log into the Pinecone Console. This will count as activity.

Video overview

Getting a list of your indexes

List all your Pinecone indexes:

pythoncurl
pinecone.list_indexes()
curl -i https://controller.us-west1-gcp.pinecone.io/databases \
  -H 'Api-Key: YOUR_API_KEY'

Creating an index

The simplest way to create an index is as follows. This gives you an index with a single shard (we call this a pod) and no additional replicas that will perform approximate nearest neighbor (ANN) search using cosine similarity:

pythoncurl
pinecone.create_index("example-index", dimension=128)
curl -i -X POST https://controller.us-west1-gcp.pinecone.io/databases \
  -H 'Api-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "example-index",
    "dimension": 128
  }'

This is usually sufficient for millions of low-dimensional vectors with a moderate Queries Per Second (QPS) requirement.

A more complex index can be created as follows. This creates an index with 2 pods (shards) and 2 replicas that will perform ANN search using Euclidean distance:

pythoncurl
pinecone.create_index("example-index", dimension=128, index_type="approximated", metric="euclidean", shards=2, replicas=2)
curl -i -X POST https://controller.us-west1-gcp.pinecone.io/databases \
  -H 'Api-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "example-index",
    "dimension": 128,
    "index_type": "approximated",
    "metric": "euclidean",
    "replicas": 2,
    "shards": 2
  }'
info

When you use metric=‘euclidean’, the most similar results are those with the lowest score.

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

Creating a hybrid index

Normal indexes store the whole runtime index in memory.

Hybrid indexes store data partially in memory and partially on disk. They can support larger data sizes, but the query times are slower.

To create a hybrid index, use a create_index call that specifies index_config={'hybrid': True}.

For example:

pythoncurl
pinecone.create_index('example-index-name', dimension=128, index_type='approximated', metric='euclidean', shards=2, k_bits=512,replicas=2,index_config={'hybrid': True})
curl -i -X POST \
  -H 'Content-Type: application/json' \
  -H 'Api-Key: YOUR_API_KEY' \
  https://controller.us-west1-gcp.pinecone.io \
  -d '{
    "name": "example-index-name",
    "dimension": 128,
    "index_type": "approximated",
    "metric": "euclidean",
    "replicas": 2,
    "shards": 2,
      "index_config": {
      "k_bits": 512,
      "hybrid": true
    }
  }'
warning

We use s1 pods for hybrid indexes, rather than p1 pods. Each s1 pod can store up to 5 GB of data.

The s1 pods are priced differently, and they require a Standard account. See pricing for more details.

Deleting an index

This operation will delete all of the data and the computing resources associated with the index.

Caution

When you create an index, it runs as a service until you delete it. Users are billed for running indexes, so we recommend you delete any indexes you're not using. This will minimize your costs.

Delete a Pinecone index named "pinecone-index":

pythoncurl
pinecone.delete_index("example-index")
curl -i -X DELETE https://controller.us-west1-gcp.pinecone.io/databases/example-index \
  -H 'Api-Key: YOUR_API_KEY'

Describing an index

Get the configuration and current status of an index named "pinecone-index":

pythoncurl
pinecone.describe_index("pinecone-index")
curl -i -X GET https://controller.us-west1-gcp.pinecone.io/databases/example-index \
  -H 'Api-Key: YOUR_API_KEY'