mUpdate #
Updates multiple documents.
The number of documents that can be updated by a single request is limited by the documentsWriteCount server configuration (see the Configuring Kuzzle guide).
Query Syntax #
HTTP #
Available since 2.11.0
URL: http://kuzzle:7512/<index>/<collection>/_mUpdate[?refresh=wait_for][&retryOnConflict=<retries>][&silent]
Method: PATCH
Body:Deprecated since 2.11.0
URL: http://kuzzle:7512/<index>/<collection>/_mUpdate[?refresh=wait_for][&retryOnConflict=<retries>][&silent]
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
}
}
]
}
}Kourou #
kourou document:mUpdate <index> <collection> <body>
kourou document:mUpdate <index> <collection> <body> -a silent=trueArguments #
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 theretryOnConflictoptional 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.silent: if set, then Kuzzle will not generate notificationsAvailable since 2.9.2strict: if set, an error will occur if a document was not updatedAvailable since 2.11.0
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 an object containing 2 arrays: successes and errors
Each updated document is an object of the successes array with the following properties:
_id: document unique identifier_source: document content_version: updated document versionstatus: HTTP status code
Each errored document is an object of the errors array with the following properties:
document: original document that caused the errorstatus: HTTP error status codereason: human readable reason
If strict mode is enabled, will rather return an error if at least one document has not been updated.
{
"status": 200,
"error": null,
"index": "<index>",
"collection": "<collection>",
"action": "mUpdate",
"controller": "document",
"requestId": "<unique request identifier>",
"result": {
"successes": [
{
"_id": "<documentId>",
"status": 200,
"_source": {
// updated document content
},
"_version": 2
},
{
"_id": "<anotherDocumentId>",
"status": 200,
"_source": {
// updated document content
},
"_version": 2
}
],
"errors": [
{
"document": {
// updated document content
},
"status": 404,
"reason": "Document 'foobar' not found"
}
]
}
}