v1

latestOpenAPI 3.0.3Apache 2.02026-07-1372170520.1 KB
Vector Operations

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.

post/records/namespaces/{namespace}/search

Path parameters

namespacestring required

The namespace to search.

Headers

X-Pinecone-Api-Versionstring required

Required date-based version header

Request body

fieldsstring[]

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

Example request

{
  "fields": [
    "chunk_text"
  ],
  "query": {
    "inputs": {
      "text": "your query text"
    },
    "top_k": 10
  }
}

Response

A successful search namespace response.

Example response

{
  "result": {
    "hits": [
      {
        "_id": "example-record-1",
        "_score": 0.9281134605407715,
        "fields": {
          "data": "your example text"
        }
      }
    ]
  },
  "usage": {
    "embed_total_tokens": 10,
    "read_units": 5
  }
}