POST
/
query
curl --request POST \
     --url https://index_name-project_id.svc.environment.pinecone.io/query \
     --header 'accept: application/json' \
     --header 'content-type: application/json'
{
  "matches": [
    {
      "id": "example-vector-1",
      "score": 0.08,
      "values": [
        0.1,
        0.2,
        0.3,
        0.4,
        0.5,
        0.6,
        0.7,
        0.8
      ],
      "sparseValues": {
        "indices": [
          1,
          312,
          822,
          14,
          980
        ],
        "values": [
          0.1,
          0.2,
          0.3,
          0.4,
          0.5
        ]
      },
      "metadata": {
        "genre": "documentary",
        "year": 2019
      }
    }
  ],
  "namespace": "<string>"
}

Authorizations

Api-Key
string
headerrequired

An API Key is required to call Pinecone APIs. Get yours at https://app.pinecone.io/.

Body

application/json
namespace
string

The <a href='https://docs.pinecone.io/docs/namespaces'>namespace</a> to query.

topK
integer
required

The number of results to return for each query.

filter
object

The filter to apply. You can use vector metadata to limit your search. See https://www.pinecone.io/docs/metadata-filtering/.

includeValues
boolean
default: false

Indicates whether vector values are included in the response.

includeMetadata
boolean
default: false

Indicates whether metadata is included in the response as well as the ids.

queries
object[]
deprecated

DEPRECATED. The query vectors. Each query() request can contain only one of the parameters queries, vector, or id.

vector
number[]

The query vector. This should be the same length as the dimension of the index being queried. Each query() request can contain only one of the parameters id or vector.

sparseVector
object

Vector sparse data. Represented as a list of indices and a list of corresponded values, which must be the same length.

id
string

The unique ID of the vector to be used as a query vector. Each query() request can contain only one of the parameters queries, vector, or id.

Response

200 - application/json
matches
object[]

The matches for the vectors.

namespace
string

The <a href='https://docs.pinecone.io/docs/namespaces'>namespace</a> for the vectors.

Was this page helpful?