Skip to main content
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
)

Documentation Index

Fetch the complete documentation index at: https://docs.pinecone.io/llms.txt

Use this file to discover all available pages before exploring further.

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

Api-Key
string
header
required

An API Key is required to call Pinecone APIs. Get yours from the console.

Headers

X-Pinecone-Api-Version
string
default:202601-alpha
required

Required date-based version header

Body

application/json

The request for the fetch_by_metadata operation.

namespace
string

The namespace to fetch records from.

Example:

"example-namespace"

filter
object

Metadata filter expression to select vectors. See Understanding metadata.

Example:
{
"genre": { "$in": ["comedy", "documentary", "drama"] },
"year": { "$eq": 2019 }
}
limit
integer<int64>
default:100

Max number of vectors to return.

Required range: x >= 1
Example:

12

paginationToken
string

Pagination token to continue a previous listing operation.

Example:

"Tm90aGluZyB0byBzZWUgaGVyZQo="

Response

A successful response.

The response for the fetch_by_metadata operation.

vectors
object

The fetched vectors, in the form of a map between the fetched ids and the fetched vectors

namespace
string
default:""

The namespace of the vectors.

Example:

"example-namespace"

usage
object
pagination
object