younifyd
Menu

Update documents

Update documents

POST/namespaces/{namespace}/documents/update

Use it in a workflow

  1. Add a step and choose the Pinecone connector.
  2. Pick the Update documents action (under Data).
  3. Fill in the fields below, then reference the result from later steps as {{updateDocuments.response.data}}.

Request

Path parameters

namespacestringrequired

The namespace to update documents in.

Request body

Enter the body as JSON in the step's Body field.

documentsarray<object>

The list of partial document updates to apply. At most 1000 updates, or 96 on an index whose schema declares `embed` or `sparse_embed`. Mutually exclusive with `filter`, and with a non-empty `set_fields` or `remove_fields`. `maxItems` states the general limit. A client that batches updates must size batches at 96 when any field of the index schema declares `embed` or `sparse_embed`.

_idstringrequired

The unique identifier of the document to update.

_remove_fieldsarray<string>

A list of field names to delete from the document.

filterobject

A metadata filter expression selecting the documents to patch with `set_fields` and `remove_fields`. Must not be empty; an empty filter is rejected rather than matching every document. Text-match operators (`$match_phrase`, `$match_all`, `$match_any`) are not supported here, since documents are selected on metadata alone. Mutually exclusive with `documents`.

set_fieldsobject

The fields to set on every document matching `filter`, and the values to set them to. Only metadata fields can be set here; every data field is refused, that is, vector fields, full-text-searchable text and embedded text, not only fields that declare `embed` or `sparse_embed`. Update those per ID with `documents`. When non-empty, only valid together with `filter`; an empty object asks for no change and is ignored.

remove_fieldsarray<string>

The names of the fields to remove from every document matching `filter`. Only metadata fields can be removed here; data fields are refused, as in `set_fields`. When non-empty, only valid together with `filter`; an empty list asks for no change and is ignored.

json
{
  "documents": [
    {
      "_id": "doc-1",
      "_remove_fields": [
        "content"
      ],
      "title": "Updated title"
    }
  ],
  "filter": {
    "category": {
      "$eq": "news"
    }
  },
  "set_fields": {
    "category": "archive"
  },
  "remove_fields": [
    "reviewer"
  ]
}

Response

Returns 202 with an object. Read it in later steps with {{updateDocuments.response.data.<field>}}.

matched_recordsinteger (int32)

The number of documents that matched `filter` when the update was accepted. Only returned for a filtered update; a per-ID update reports no count. The patch is applied asynchronously, so this is a point-in-time count rather than a guarantee of the number of documents ultimately patched.

usageobject

Usage information for the `upsert_documents` and `update_documents` operations. Present only when the request embedded text, that is, when it wrote text to a field whose schema declares `embed` or `sparse_embed`. A request that embedded nothing returns no `usage`.

embed_total_tokensinteger (int32)required

The total number of tokens Pinecone embedded for the request, summed over every embedding call it made, dense and sparse, across all fields and models. Documents aren't deduplicated by `_id` within an upsert, so every entry's text is embedded and counted, including entries that repeat an `_id`.

json
{
  "matched_records": 42,
  "usage": {
    "embed_total_tokens": 24
  }
}

Need more? See the Pinecone guide for connection setup and behaviour shared by every action.