v1

latestOpenAPI 3.0.3Apache 2.02026-07-1372170520.1 KB
Vector Operations

Update a record

Update records by ID or by metadata in a namespace. Updating by ID changes the vector and/or metadata of a single record. Updating by metadata changes metadata across multiple records using a metadata filter. If a vector value is included, it will overwrite the previous value. If set_metadata is included, only the specified metadata fields are modified, and if a specified metadata field does not exist, it is added. For guidance and examples, see Update data.

post/vectors/update

Headers

X-Pinecone-Api-Versionstring required

Required date-based version header

Request body

idstring

Vector's unique id.

valuesnumber[]

Vector data.

setMetadataobject

Metadata to set for the record.

namespacestring

The namespace containing the record to update.

filterobject

A metadata filter expression. When updating metadata across records in a namespace, the update is applied to all records that match the filter. See Understanding metadata.

dryRunboolean

If true, return the number of records that match the filter, but do not execute the update. Default is false.

Example request

{
  "id": "example-vector-1",
  "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
    ]
  },
  "setMetadata": {
    "genre": "documentary",
    "year": 2019
  },
  "namespace": "example-namespace",
  "filter": {
    "genre": {
      "$in": [
        "comedy",
        "documentary",
        "drama"
      ]
    },
    "year": {
      "$eq": 2019
    }
  }
}

Response

A successful response.

matchedRecordsinteger

The number of records that matched the filter (if a filter was provided).

Example response

{
  "matchedRecords": 42
}