mUpdate #
Updates multiple documents.
Query Syntax #
HTTP #
URL: http://kuzzle:7512/<index>/<collection>/_mUpdate[?refresh=wait_for][&retryOnConflict=<retries>]
Method: PUT
Body:
{
"documents": [
{
"_id": "<documentId>",
"body": {
// document changes
}
},
{
"_id": "<anotherDocumentId>",
"body": {
// document changes
}
}
]
}
Other protocols #
{
"index": "<index>",
"collection": "<collection>",
"controller": "document",
"action": "mUpdate",
"body": {
"documents": [
{
"_id": "<documentId>",
"body": {
// document changes
}
},
{
"_id": "<anotherDocumentId>",
"body": {
// document changes
}
}
]
}
}
Arguments #
collection
: collection nameindex
: index name
Optional: #
refresh
: if set towait_for
, Kuzzle will not respond until the updates are indexedretryOnConflict
: conflicts may occur if the same document gets updated multiple times within a short timespan in a database cluster. You can set theretryOnConflict
optional argument (with a retry count), to tell Kuzzle to retry the failing updates the specified amount of times before rejecting the request with an error.
Body properties #
documents
: an array of object. Each object describes a document to update, by exposing the following properties:_id
: ID of the document to replacebody
: partial changes to apply to the document
Response #
Returns a hits
array containing the list of updated documents.
Each document has the following properties:
_id
: document unique identifier_source
: updated document content_version
: version number of the document
If one or more document cannot be updated, the response status is set to 206
, and the error
object contain a partial error error.
{
"status": 200,
"error": null,
"index": "<index>",
"collection": "<collection>",
"action": "mUpdate",
"controller": "document",
"requestId": "<unique request identifier>",
"result": {
"hits": [
{
"_id": "<documentId>",
"_version": 2,
"_source": {
// updated document content
}
},
{
"_id": "<anotherDocumentId>",
"_version": 4,
"_source": {
// updated document content
}
}
],
"total": 2
}
}
Edit this page on Github(opens new window)