Skip to main content
POST
/
records
/
namespaces
/
{namespace}
/
search
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")

results = index.search(
    namespace="example-namespace",
    query={
        "inputs": {"text": "search query"},
        "top_k": 3
    },
    fields=["category", "chunk_text"]
)

print(results)

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")

results = index.search(
    namespace="example-namespace",
    query={
        "inputs": {"text": "search query"},
        "top_k": 3
    },
    fields=["category", "chunk_text"]
)

print(results)

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

Path Parameters

namespace
string
required

The namespace to search.

Body

application/json

A search request for records in a specific namespace.

query
object
required

.

fields
string[]

The fields to return in the search results. If not specified, the response will include all fields.

Example:
["chunk_text"]
rerank
object

Parameters for reranking the initial search results.

Response

A successful search namespace response.

The records search response.

result
object
required
usage
object
required