This page shows you how to migrate a pod-based index to serverless. The migration process is free; the standard costs of upserting records to a new serverless index are not applied.
In most cases, migrating to serverless reduces costs significantly. However, costs can increase for read-heavy workloads with more than 1 query per second and for indexes with many records in a single namespace. Before migrating, consider contacting Pinecone Support for help estimating and managing cost implications.
Migration is supported for pod-based indexes on GCP and AWS with less than 25 million records and 20,000 namespaces.Also, serverless indexes do not support the following features. If you were using these features for your pod-based index, you will need to adapt your code. If you are blocked by these limitations, contact Pinecone Support.
Migrating a pod-based index to serverless is a 2-step process:
1
Save the pod-based index as a collection
2
Create a new serverless index from the collection
After migration, you will have both a new serverless index and the original pod-based index. Once you’ve switched your workload to the serverless index, you can delete the pod-based index to avoid paying for unused resources.
In most cases, migrating to serverless reduces costs significantly. However, costs can increase for read-heavy workloads with more than 1 query per second and for indexes with many records in a single namespace.Before migrating, consider contacting Pinecone Support for help estimating and managing cost implications.
Migrating a pod-based index to serverless can take anywhere from a few minutes to several hours, depending on the size of the index. During that time, you can continue reading from the pod-based index. However, all upserts, updates, and deletes to the pod-based index will not automatically be reflected in the new serverless index, so be sure to prepare in one of the following ways:
Pause write traffic: If downtime is acceptable, pause traffic to the pod-based index before starting migration. After migration, you will start sending traffic to the serverless index.
Log your writes: If you need to continue reading from the pod-based index during migration, send read traffic to the pod-based index, but log your writes to a temporary location outside of Pinecone (e.g., S3). After migration, you will replay the logged writes to the new serverless index and start sending all traffic to the serverless index.
In the Pinecone console, go to your pod-based index and click the ellipsis (…) menu > Migrate to serverless.
The dropdown will not display Migrate to serverless if the index has any of the listed limitations.
To save the legacy index and create a new serverless index now, follow the prompts.Depending on the size of the index, migration can take anywhere from a few minutes to several hours. While migration is in progress, you’ll see the yellow Initializing status:
When the new serverless index is ready, the status will change to green:
You must make some minor code changes to work with serverless indexes.
Serverless indexes do not support some features, as outlined in Limitations. If you were relying on these features for your pod-based index, you’ll need to adapt your code.
Change how you import the Pinecone library and authenticate and initialize the client:
Copy
from pinecone.grpc import PineconeGRPC as Pineconefrom pinecone import ServerlessSpec, PodSpec # ServerlessSpec and PodSpec are required only when # creating serverless and pod-based indexes. pc = Pinecone(api_key="YOUR_API_KEY")
Listing indexes now fetches a complete description of each index. If you were relying on the output of this operation, you’ll need to adapt your code.
Copy
from pinecone.grpc import PineconeGRPC as Pineconepc = Pinecone(api_key="YOUR_API_KEY")index_list = pc.list_indexes()print(index_list)
The list_indexes operation now returns a response like the following:
Describing an index now returns a description of an index in a different format. It also returns the index host needed to run data plane operations against the index. If you were relying on the output of this operation, you’ll need to adapt your code.
Copy
from pinecone.grpc import PineconeGRPC as Pineconepc = Pinecone(api_key="YOUR_API_KEY")pc.describe_index(name="docs-example")
It is not possible to save a serverless index as a collection, so if you want to retain the option to recreate your pod-based index, be sure to keep the collection you created earlier.