curl --request POST \
--url https://{projectHost}/collections/{collectionName}/docs/update \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"docs": [
{
"id": "example-id1",
"example-field1": "example-value1",
"example-field2": [
0.1,
0.2,
0.3
]
},
{
"id": "example-id2",
"example-field1": "example-value2",
"example-field2": [
0.4,
0.5,
0.6
]
}
]
}
'import requests
url = "https://{projectHost}/collections/{collectionName}/docs/update"
payload = { "docs": [
{
"id": "example-id1",
"example-field1": "example-value1",
"example-field2": [0.1, 0.2, 0.3]
},
{
"id": "example-id2",
"example-field1": "example-value2",
"example-field2": [0.4, 0.5, 0.6]
}
] }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
docs: [
{
id: 'example-id1',
'example-field1': 'example-value1',
'example-field2': [0.1, 0.2, 0.3]
},
{
id: 'example-id2',
'example-field1': 'example-value2',
'example-field2': [0.4, 0.5, 0.6]
}
]
})
};
fetch('https://{projectHost}/collections/{collectionName}/docs/update', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{projectHost}/collections/{collectionName}/docs/update",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'docs' => [
[
'id' => 'example-id1',
'example-field1' => 'example-value1',
'example-field2' => [
0.1,
0.2,
0.3
]
],
[
'id' => 'example-id2',
'example-field1' => 'example-value2',
'example-field2' => [
0.4,
0.5,
0.6
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{projectHost}/collections/{collectionName}/docs/update"
payload := strings.NewReader("{\n \"docs\": [\n {\n \"id\": \"example-id1\",\n \"example-field1\": \"example-value1\",\n \"example-field2\": [\n 0.1,\n 0.2,\n 0.3\n ]\n },\n {\n \"id\": \"example-id2\",\n \"example-field1\": \"example-value2\",\n \"example-field2\": [\n 0.4,\n 0.5,\n 0.6\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{projectHost}/collections/{collectionName}/docs/update")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"docs\": [\n {\n \"id\": \"example-id1\",\n \"example-field1\": \"example-value1\",\n \"example-field2\": [\n 0.1,\n 0.2,\n 0.3\n ]\n },\n {\n \"id\": \"example-id2\",\n \"example-field1\": \"example-value2\",\n \"example-field2\": [\n 0.4,\n 0.5,\n 0.6\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{projectHost}/collections/{collectionName}/docs/update")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"docs\": [\n {\n \"id\": \"example-id1\",\n \"example-field1\": \"example-value1\",\n \"example-field2\": [\n 0.1,\n 0.2,\n 0.3\n ]\n },\n {\n \"id\": \"example-id2\",\n \"example-field1\": \"example-value2\",\n \"example-field2\": [\n 0.4,\n 0.5,\n 0.6\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "Update request is accepted"
}{
"message": "Invalid request"
}{
"message": "Authentication failed"
}{
"message": "Project inference quota exceeded"
}{
"message": "Resource not found"
}{
"message": "<string>"
}{
"message": "Too many requests"
}{
"message": "Internal server error"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}Update documents
Update existing documents by ID with a strongly consistent read followed by a merged replacement. Omitted fields are preserved, nested objects are recursively merged, and arrays are replaced. Indexed fields reject null. A missing ID in the selected branch and partition rejects the whole request with 400 before submission. No document-version precondition is supported; concurrent updates can overwrite each other. The maximum supported payload size is 6MB.
curl --request POST \
--url https://{projectHost}/collections/{collectionName}/docs/update \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"docs": [
{
"id": "example-id1",
"example-field1": "example-value1",
"example-field2": [
0.1,
0.2,
0.3
]
},
{
"id": "example-id2",
"example-field1": "example-value2",
"example-field2": [
0.4,
0.5,
0.6
]
}
]
}
'import requests
url = "https://{projectHost}/collections/{collectionName}/docs/update"
payload = { "docs": [
{
"id": "example-id1",
"example-field1": "example-value1",
"example-field2": [0.1, 0.2, 0.3]
},
{
"id": "example-id2",
"example-field1": "example-value2",
"example-field2": [0.4, 0.5, 0.6]
}
] }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
docs: [
{
id: 'example-id1',
'example-field1': 'example-value1',
'example-field2': [0.1, 0.2, 0.3]
},
{
id: 'example-id2',
'example-field1': 'example-value2',
'example-field2': [0.4, 0.5, 0.6]
}
]
})
};
fetch('https://{projectHost}/collections/{collectionName}/docs/update', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{projectHost}/collections/{collectionName}/docs/update",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'docs' => [
[
'id' => 'example-id1',
'example-field1' => 'example-value1',
'example-field2' => [
0.1,
0.2,
0.3
]
],
[
'id' => 'example-id2',
'example-field1' => 'example-value2',
'example-field2' => [
0.4,
0.5,
0.6
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{projectHost}/collections/{collectionName}/docs/update"
payload := strings.NewReader("{\n \"docs\": [\n {\n \"id\": \"example-id1\",\n \"example-field1\": \"example-value1\",\n \"example-field2\": [\n 0.1,\n 0.2,\n 0.3\n ]\n },\n {\n \"id\": \"example-id2\",\n \"example-field1\": \"example-value2\",\n \"example-field2\": [\n 0.4,\n 0.5,\n 0.6\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{projectHost}/collections/{collectionName}/docs/update")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"docs\": [\n {\n \"id\": \"example-id1\",\n \"example-field1\": \"example-value1\",\n \"example-field2\": [\n 0.1,\n 0.2,\n 0.3\n ]\n },\n {\n \"id\": \"example-id2\",\n \"example-field1\": \"example-value2\",\n \"example-field2\": [\n 0.4,\n 0.5,\n 0.6\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{projectHost}/collections/{collectionName}/docs/update")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"docs\": [\n {\n \"id\": \"example-id1\",\n \"example-field1\": \"example-value1\",\n \"example-field2\": [\n 0.1,\n 0.2,\n 0.3\n ]\n },\n {\n \"id\": \"example-id2\",\n \"example-field1\": \"example-value2\",\n \"example-field2\": [\n 0.4,\n 0.5,\n 0.6\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "Update request is accepted"
}{
"message": "Invalid request"
}{
"message": "Authentication failed"
}{
"message": "Project inference quota exceeded"
}{
"message": "Resource not found"
}{
"message": "<string>"
}{
"message": "Too many requests"
}{
"message": "Internal server error"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}Body
Documents to update; each must contain the existing document ID and, for partitioned documents outside default, its existing partition-field value. Omitted fields are preserved. Objects merge recursively; arrays and scalars replace existing values. Null is rejected for indexed fields and stored as JSON null for unindexed fields, not as a field deletion. For native embedding fields, an explicitly supplied vector takes precedence. Otherwise equivalent input reuses an existing vector, changed source input regenerates it, and removal of the last source removes an inherited vector. Metadata-only updates preserve direct vectors when raw source fields are unchanged.
1Was this page helpful?