# pip install "pinecone[grpc]"
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/manage-data/target-an-index
index = pc.Index(host="INDEX_HOST")
# To iterate over all result pages using a generator function
for ids in index.list(prefix="doc1#", namespace="example-namespace"):
print(ids)
# For manual control over pagination
results = index.list_paginated(
prefix="doc1#",
limit=3,
namespace="example-namespace",
pagination_token="eyJza2lwX3Bhc3QiOiIxMDEwMy0="
)
['doc1#chunk1', 'doc1#chunk2', 'doc1#chunk3']
{'read_units': 1}
List vector IDs
The list operation lists the IDs of vectors in a single namespace of a serverless index. An optional prefix can be passed to limit the results to IDs with a common prefix.
list returns up to 100 IDs at a time by default in sorted order (bitwise “C” collation). If the limit parameter is set, list returns up to that number of IDs instead. Whenever there are additional IDs to return, the response also includes a pagination_token that you can use to get the next batch of IDs. When the response does not include a pagination_token, there are no more IDs to return.
For guidance and examples, see List record IDs.
Note: list is supported only for serverless indexes.
# pip install "pinecone[grpc]"
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/manage-data/target-an-index
index = pc.Index(host="INDEX_HOST")
# To iterate over all result pages using a generator function
for ids in index.list(prefix="doc1#", namespace="example-namespace"):
print(ids)
# For manual control over pagination
results = index.list_paginated(
prefix="doc1#",
limit=3,
namespace="example-namespace",
pagination_token="eyJza2lwX3Bhc3QiOiIxMDEwMy0="
)
['doc1#chunk1', 'doc1#chunk2', 'doc1#chunk3']
{'read_units': 1}
# pip install "pinecone[grpc]"
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/manage-data/target-an-index
index = pc.Index(host="INDEX_HOST")
# To iterate over all result pages using a generator function
for ids in index.list(prefix="doc1#", namespace="example-namespace"):
print(ids)
# For manual control over pagination
results = index.list_paginated(
prefix="doc1#",
limit=3,
namespace="example-namespace",
pagination_token="eyJza2lwX3Bhc3QiOiIxMDEwMy0="
)
['doc1#chunk1', 'doc1#chunk2', 'doc1#chunk3']
{'read_units': 1}
Authorizations
Query Parameters
The vector IDs to fetch. Does not accept values containing spaces.
Max number of IDs to return per page.
Pagination token to continue a previous listing operation.
Response
A successful response.
Was this page helpful?