Update documents
In an index with a document schema, upsert replaces the whole document for a given_id. To change individual fields instead, use the documents update operation, which leaves the fields you don’t mention unchanged.
To patch specific documents, send one entry per _id. Include the fields you want to set, and name any fields to drop in _remove_fields. Both schema-declared fields and metadata fields can be set or removed this way:
filter with set_fields, remove_fields, or both:
Limitations
- By-ID requests: Each request can patch up to 1,000 documents, or 96 when the schema declares
embedorsparse_embed(even a metadata-only patch). See Update limits. - By-filter requests:
set_fieldsandremove_fieldsboth accept metadata fields only, and reject a field declared in the schema with a400. A by-filter update applies one value to every matched document, which would leave vector and full-text-searchable fields identical across the whole match set. To change a schema-declared field, patch each document by ID. - Text-match filters: A by-filter update rejects text-match operators (
$match_phrase,$match_all,$match_any) with a400. To update documents by text match, search for them first and patch the IDs the search returns.