from pinecone import 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")
index.fetch_by_metadata(
namespace="example-namespace",
filter={"genre": {"$eq": "drama"}},
limit=10
)
Vectors
Fetch records by metadata
Look up and return records by metadata from a single namespace. The returned records include the vector data and metadata. For guidance and examples, see Fetch data.
POST
/
vectors
/
fetch_by_metadata
from pinecone import 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")
index.fetch_by_metadata(
namespace="example-namespace",
filter={"genre": {"$eq": "drama"}},
limit=10
)
from pinecone import 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")
index.fetch_by_metadata(
namespace="example-namespace",
filter={"genre": {"$eq": "drama"}},
limit=10
)
Authorizations
Headers
Required date-based version header
Body
application/json
The request for the fetch_by_metadata operation.
The namespace to fetch records from.
Example:
"example-namespace"
Metadata filter expression to select vectors. See Understanding metadata.
Example:
{
"genre": { "$in": ["comedy", "documentary", "drama"] },
"year": { "$eq": 2019 }
}Max number of vectors to return.
Required range:
x >= 1Example:
12
Pagination token to continue a previous listing operation.
Example:
"Tm90aGluZyB0byBzZWUgaGVyZQo="
Response
A successful response.
The response for the fetch_by_metadata operation.
Was this page helpful?
⌘I