update #
Applies partial changes to a document. The document must exist in the storage layer.
Query Syntax #
HTTP #
Available since 2.11.0
URL: http://kuzzle:7512/<index>/<collection>/<_id>/_update[?refresh=wait_for][&retryOnConflict=<int>][&source][&silent]
Method: PATCH
Body:
Deprecated since 2.11.0
URL: http://kuzzle:7512/<index>/<collection>/<_id>/_update[?refresh=wait_for][&retryOnConflict=<int>][&source][&silent]
Method: PUT
Body:
{
// document changes
}
Other protocols #
{
"index": "<index>",
"collection": "<collection>",
"controller": "document",
"action": "update",
"_id": "<documentId>",
"body": {
// document changes
}
}
Kourou #
kourou document:update <index> <collection> <id> <body>
kourou document:update <index> <collection> <id> <body> -a silent=true
Arguments #
_id
: unique identifier of the document to updatecollection
: collection nameindex
: 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.source
: if set totrue
Kuzzle will return the entire updated document body in the response.silent
: if set, then Kuzzle will not generate notificationsAvailable since 2.9.2
Body properties #
Partial changes to apply to the document.
Response #
Returns information about the updated document:
_id
: document unique identifier_version
: updated document version_source
: contains only changes or the full document ifsource
is set totrue
{
"status": 200,
"error": null,
"index": "<index>",
"collection": "<collection>",
"controller": "document",
"action": "update",
"requestId": "<unique request identifier>",
"result": {
"_id": "<documentId>",
"_version": 2,
"_source": "<partial or entire document>"
}
}
Edit this page on Github(opens new window)