Back up indexes
Overview
This document describes how to make backup copies of your indexes using collections.
To learn how to create an index from a collection, see Manage indexes.
Warning
This document uses collections. This is a public preview
feature. Test thoroughly before using this feature with production workloads.
Create a backup using a collection
To create a backup of your index, use the create_collection
operation. A collection is a static copy of your index that only consumes storage.
Example
The following example creates a collection named example-collection
from an index named example-index
.
pinecone.create_collection("example-collection", "example-index")
await pinecone.createCollection({
name: "example-collection",
source: "example-index",
});
curl -i -X POST https://controller.us-west1-gcp.pinecone.io/collections \
-H 'Api-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"name": "example-collection",
"source": "example-index"
}'
Check the status of a collection
To retrieve the status of the process creating a collection and the size of the collection, use the describe_collection
operation. Specify the name of the collection to check. You can only call describe_collection
on a collection in the current project.
The describe_collection
operation returns an object containing key-value pairs representing the name of the collection, the size in bytes, and the creation status of the collection.
Example
The following example gets the creation status and size of a collection named example-collection
.
pinecone.describe_collection("example-collection")
const collectionDescription = await pinecone.describeCollection(
"example-collection"
);
console.log(collectionDescription.data);
curl -i -X GET https://controller.us-west1-gcp.pinecone.io/collections/example-collection \
-H 'Api-Key: YOUR_API_KEY'
Results:
CollectionDescription(name='test-collection', size=3818809, status='Ready')
List your collections
To get a list of the collections in the current project, use the list_collections
operation.
Example
The following example gets a list of all collections in the current project.
pinecone.list_collections()
const collections = await pinecone.listCollections();
console.log(collections.data);
curl -i -X GET https://controller.us-west1-gcp.pinecone.io/collections \
-H 'Api-Key: YOUR_API_KEY'
Results
example-collection
Delete a collection
To delete a collection, use the delete_collection
operation. Specify the name of the collection to delete.
Deleting the collection takes several minutes. During this time, the describe_collection
operation returns the status "deleting"
.
Example
The following example deletes the collection example-collection
.
pinecone.delete_collection("example-collection")
await pinecone.deleteCollection("example-collection");
curl -i -X DELETE https://controller.us-west1-gcp.pinecone.io/collections/example-collection \
-H 'Api-Key: YOUR_API_KEY'
Updated 4 months ago