Skip to main content
POST
Filters apply before scoring, so only documents that match the filter are ranked. For how each scoring type works and how to combine them, see Full-text search and the query syntax reference.

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:2026-07
required

Required date-based version header

Path Parameters

namespace
string
required

The namespace to search.

Body

application/json

The request for the search_documents operation.

score_by
required

The list of scoring methods to use for ranking documents.

A single clause of any type is always valid. Several clauses may be combined only when every one of them is text or query_string; a dense_vector or sparse_vector clause must appear on its own.

Required array length: 1 element

A scoring method that defines how documents are scored against a query.

The type field determines which other fields are used:

  • dense_vector: Score by dense vector similarity. Requires either field or fields naming exactly one field, and a values array.
  • sparse_vector: Score by sparse vector similarity. Requires either field or fields naming exactly one field, and sparse_values.
  • text: Score by BM25 text similarity. Requires either field or fields naming one or more fields, and query. Naming several fields scores the query against all of them.
  • query_string: Score using a Lucene query string. Use field qualifiers (field:(clause)) to target a field, or omit field qualifiers to search against all text-searchable fields. Errors if field or fields is provided.
Example:
top_k
integer<int32>
required

The number of top-ranked documents to return.

Required range: 1 <= x <= 10000
Example:

10

include_fields
string[]

The document fields to return on each match alongside _id and _score. When omitted or empty, no fields are returned. Pass ["*"] to return every field.

Example:
filter
object

A metadata filter expression to restrict the documents searched.

Response

A successful search response.

The response for the search_documents operation.

matches
object[]
required

The matching documents, ordered from most to least similar.

namespace
string
required

The namespace that served the search: the request's namespace, or the alias's target namespace when the request named a namespace alias.

Example:

"my-namespace"

usage
object
required

Usage information for the search_documents operation.

Example: