Skip to main content
This page shows you how to upsert documents into a collection. The REST request accepts an optional branch field. Omitting it writes to the default branch, main; a tag or alias is not a valid write target. Document field names are preserved as supplied in every SDK. The examples use dense_vector and sparse_vector; configure indexes with those same names to search these values.
If the collection contains managed embedding vector fields, send only the configured source text fields. Do not send direct vector values for managed embedding fields in an upsert request.
The cURL example writes to the candidate branch. Remove branch to write to main.

Response

Each document implicitly contains an id field in order to uniquely identify a document. A unique string value is auto-generated by the system if id field is not provided in an upsert request. If you want to overwrite the entire document, you can do so by providing the id field in the document.
For a partitioned collection, documents are upserted into the __default__ partition if the partition field is not provided.

Upsert limits

When upserting larger amounts of data, it is recommended to use bulk-upsert operation.