Search with text
Search a namespace with a query text, query vector, or record ID and return the most similar records, along with their similarity scores. Optionally, rerank the initial results based on their relevance to the query.
Searching with text is supported only for indexes with integrated embedding. Searching with a query vector or record ID is supported for all indexes.
For guidance and examples, see Search.
INDEX_HOST="INDEX_HOST"
NAMESPACE="YOUR_NAMESPACE"
PINECONE_API_KEY="YOUR_API_KEY"
# Search with a query text and rerank the results
# Supported only for indexes with integrated embedding
curl "https://$INDEX_HOST/records/namespaces/$NAMESPACE/search" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Api-Key: $PINECONE_API_KEY" \
-H "X-Pinecone-Api-Version: 2025-10" \
-d '{
"query": {
"inputs": {"text": "Disease prevention"},
"top_k": 4,
},
"fields": ["category", "chunk_text"]
"rerank": {
"model": "bge-reranker-v2-m3",
"top_n": 2,
"rank_fields": ["chunk_text"] # Specified field must also be included in 'fields'
}
}'
# Search with a query vector and rerank the results
curl "https://$INDEX_HOST/records/namespaces/$NAMESPACE/search" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Api-Key: $PINECONE_API_KEY" \
-H "X-Pinecone-Api-Version: 2025-10" \
-d '{
"query": {
"vector": {
"values": [0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3]
},
"top_k": 4,
},
"fields": ["category", "chunk_text"]
"rerank": {
"query": "Disease prevention",
"model": "bge-reranker-v2-m3",
"top_n": 2,
"rank_fields": ["chunk_text"] # Specified field must also be included in 'fields'
}
}'
# Search with a record ID and rerank the results
# Supported only for indexes with integrated embedding
curl "https://$INDEX_HOST/records/namespaces/$NAMESPACE/search" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Api-Key: $PINECONE_API_KEY" \
-H "X-Pinecone-Api-Version: 2025-10" \
-d '{
"query": {
"id": "rec1",
"top_k": 4,
},
"fields": ["category", "chunk_text"]
"rerank": {
"query": "Disease prevention",
"model": "bge-reranker-v2-m3",
"top_n": 2,
"rank_fields": ["chunk_text"]
}
}'{
"result": {
"hits": [
{
"_id": "rec3",
"_score": 0.004433765076100826,
"fields": {
"category": "immune system",
"chunk_text": "Rich in vitamin C and other antioxidants, apples contribute to immune health and may reduce the risk of chronic diseases."
}
},
{
"_id": "rec4",
"_score": 0.0029121784027665854,
"fields": {
"category": "endocrine system",
"chunk_text": "The high fiber content in apples can also help regulate blood sugar levels, making them a favorable snack for people with diabetes."
}
}
]
},
"usage": {
"embed_total_tokens": 8,
"read_units": 6,
"rerank_units": 1
}
}POST /records/namespaces/{namespace}/search
Authorizations
Section titled “Authorizations”Api-KeystringrequiredAn API Key is required to call Pinecone APIs. Get yours from the console.
Headers
Section titled “Headers”X-Pinecone-Api-VersionstringrequiredRequired date-based version header
Path Parameters
Section titled “Path Parameters”namespacestringrequiredThe namespace to search.
queryobjectrequired.
Show child attributes
top_kintegerrequiredThe number of similar records to return.
Example: 10
filter?objectThe filter to apply. You can use vector metadata to limit your search. See Understanding metadata.
inputs?objectvector?objectShow child attributes
values?number[]This is the vector data included in the request.
Required string length: 1 - 20000
sparse_values?number[]The sparse embedding values.
sparse_indices?integer[]The sparse embedding indices.
id?stringThe unique ID of the vector to be used as a query vector.
Required string length: 0 - 512. Example: example-vector-1
match_terms?objectSpecifies which terms must be present in the text of each search hit based on the specified strategy. The match is performed against the text field specified in the integrated index field_map configuration. Terms are normalized and tokenized into single tokens before matching, and order does not matter. Example: "match_terms": {"terms": ["animal", "CHARACTER", "donald Duck"], "strategy": "all"} will tokenize to ["animal", "character", "donald", "duck"], and would match "Donald F. Duck is a funny animal character" but would not match "A duck is a funny animal". Match terms filtering is supported only for sparse indexes with integrated embedding configured to use the pinecone-sparse-english-v0 model.
Show child attributes
strategy?stringThe strategy for matching terms in the text. Currently, only all is supported, which means all specified terms must be present.
terms?string[]A list of terms that must be present in the text of each search hit based on the specified strategy.
fields?string[]The fields to return in the search results. If not specified, the response will include all fields.
Required string length: 0 - 100
rerank?objectParameters for reranking the initial search results.
Show child attributes
modelstringrequiredExample: bge-reranker-v2-m3
The name of the reranking model to use.
rank_fieldsstring[]requiredThe field(s) to consider for reranking. If not provided, the default is ["text"]. The number of fields supported is model-specific.
top_n?integerThe number of top results to return after reranking. Defaults to top_k.
Example: 5
parameters?objectAdditional model-specific parameters. Refer to the model guide for available model parameters.
query?stringThe query to rerank documents against. If a specific rerank query is specified, it overwrites the query input that was provided at the top level.
Example: What is the capital of France?
Response
Section titled “Response”200 — A successful search namespace response.
The records search response.
resultobjectrequiredShow child attributes
hitsobject[]requiredThe hits for the search document request.
Show child attributes
_idstringrequiredThe record id of the search hit.
_scorenumberrequiredThe similarity score of the returned record.
fieldsobjectrequiredThe selected record fields associated with the search hit.
usageobjectrequiredShow child attributes
read_unitsintegerrequiredThe number of read units consumed by this operation.
Required range: 0 <= x. Example: 5
embed_total_tokens?integerThe number of embedding tokens consumed by this operation.
Required range: 0 <= x. Example: 2
rerank_units?integerThe number of rerank units consumed by this operation.
Required range: 0 <= x. Example: 1