v1

latestOpenAPI 3.0.3Apache 2.02026-07-2685172326.0 KB
Vector Operations

Fetch records by metadata

Look up and return records by metadata from a single namespace. The returned records include the vector data and metadata. For guidance and examples, see Fetch data.

post/vectors/fetch_by_metadata

Headers

X-Pinecone-Api-Versionstring required

Required date-based version header

Request body

namespacestring

The namespace to fetch records from.

filterobject

Metadata filter expression to select vectors. See Understanding metadata.

limitinteger

Max number of vectors to return.

paginationTokenstring

Pagination token to continue a previous listing operation.

Example request

{
  "namespace": "example-namespace",
  "filter": {
    "genre": {
      "$in": [
        "comedy",
        "documentary",
        "drama"
      ]
    },
    "year": {
      "$eq": 2019
    }
  },
  "limit": 12,
  "paginationToken": "Tm90aGluZyB0byBzZWUgaGVyZQo="
}

Response

A successful response.

vectorsobject

The fetched vectors, in the form of a map between the fetched ids and the fetched vectors

namespacestring

The namespace of the vectors.

Example response

{
  "namespace": "example-namespace",
  "pagination": {
    "next": "Tm90aGluZyB0byBzZWUgaGVyZQo="
  },
  "usage": {
    "readUnits": 5
  },
  "vectors": {
    "id-1": {
      "id": "id-1",
      "metadata": {
        "genre": "documentary",
        "year": 2019
      },
      "values": [
        1,
        1.5
      ]
    },
    "id-2": {
      "id": "id-2",
      "metadata": {
        "genre": "comedy",
        "year": 2019
      },
      "values": [
        2,
        1
      ]
    }
  }
}