This page shows you how to fetch records by ID from a dense or sparse index namespace. The returned records are complete, including all relevant vector values and metadata.

You can fetch data using the Pinecone console.

Fetch records

To fetch records, specify the record IDs and the namespace. To use the default namespace (""), specify the record IDs but no namespace.

from pinecone.grpc import PineconeGRPC as Pinecone

pc = Pinecone(api_key="YOUR_API_KEY")

# To get the unique host for an index, 
# see https://docs.pinecone.io/guides/data/target-an-index
index = pc.Index(host="INDEX_HOST")

index.fetch(ids=["id-1", "id-2"], namespace="example-namespace")

The response looks like this:

{'namespace': 'example-namespace',
 'usage': {'readUnits': 1},
 'vectors': {'id-1': {'id': 'id-1',
                      'values': [0.568879, 0.632687092, 0.856837332, ...]},
             'id-2': {'id': 'id-2',
                      'values': [0.00891787093, 0.581895, 0.315718859, ...]}}}

Data freshness

Pinecone is eventually consistent, so there can be a slight delay before new or changed records are visible to queries. You can view index stats to check data freshness.

Was this page helpful?