update
Updates a document content.
Query Syntax
HTTP
URL: http://kuzzle:7512/<index>/<collection>/<documentId>/_update[?refresh=wait_for][&retryOnConflict=<int>]
Method: PUT
Body:
{
// document changes
}
Other protocols
{
"index": "<index>",
"collection": "<collection>",
"controller": "document",
"action": "update",
"_id": "<documentId>",
"body": {
// document changes
}
}
Arguments
collection
: collection namedocumentId
: unique identifier of the document to updateindex
: index name
Optional:
refresh
: if set towait_for
, Kuzzle will not respond until the update is 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
Partial changes to apply to the document.
Response
Returns information about the updated documents:
_id
: document unique identifier_version
: updated document version
{
"status": 200,
"error": null,
"index": "<index>",
"collection": "<collection>",
"controller": "document",
"action": "update",
"requestId": "<unique request identifier>",
"result": {
"_id": "<documentId>",
"_version": 2
}
}