Skip to main content
POST
A request includes a score_by array selecting one of the following scoring types:
  • type: "text", BM25 token matching over one or more text fields named in fields; naming several scores the query against all of them. Multi-word queries use OR-style matching (case-insensitive). For exact-phrase ranking, use query_string with quoted terms.
  • type: "query_string", Lucene query syntax. Supports boolean operators, phrase prefix matching, boosting, fuzzy matching (term~, term~N), and cross-field queries. See the query syntax reference. Does not accept a field or fields parameter. Target specific fields using Lucene field qualifiers in the query string itself: fieldname:value or title:(alpha) OR body:(beta).
  • type: "dense_vector", dense vector similarity ranking against a dense_vector field.
  • type: "sparse_vector", sparse vector similarity ranking against a sparse_vector field.
Any scoring method can be combined with metadata filters (including text match operators $match_phrase / $match_all / $match_any and logical operators $and / $or / $not). Filters are applied before scoring: the search only considers documents that match the filter. Scoring-only operators are available in query_string scoring but cannot be used inside filter: phrase slop ("phrase"~N), term boosting (^N), and phrase prefix ("phrase pre"*). include_fields defaults to [] (returns only _id and _score); use ["*"] to return all stored fields.
A single search request ranks by one scoring type. Multi-field BM25 is supported: name several fields in one text clause’s fields array, or pass multiple text clauses, which the server combines into one ranking; a query_string clause can also target several fields. Every contributing field weighs equally in 2026-07; there is no per-field weight parameter. To combine BM25 ranking with dense_vector or sparse_vector ranking, restrict the dense (or sparse) search with a text-match filter ($match_phrase, $match_all, $match_any) on the full-text field, or run separate searches and merge the results client-side.
Text match operators are only valid on this endpoint. Plain metadata filters, however, are also accepted by fetch, update, and delete, so you can fetch, update, or delete documents matching a metadata expression directly. Text match operators ($match_phrase, $match_all, $match_any) stay search-only; to act on their results elsewhere, search first to get IDs.

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 was searched.

Example:

"my-namespace"

usage
object
required

Usage information for the search_documents operation.

Example: