Core
API v1.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

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 name
  • documentId: unique identifier of the document to update
  • index: index name

Optional: #

  • refresh: if set to wait_for, Kuzzle will not respond until the update is indexed
  • retryOnConflict: conflicts may occur if the same document gets updated multiple times within a short timespan, in a database cluster. You can set the retryOnConflict 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
  }
}