diff --git a/docs/reference/docs/update.asciidoc b/docs/reference/docs/update.asciidoc index 64c0f67bc72..66e5783e7eb 100644 --- a/docs/reference/docs/update.asciidoc +++ b/docs/reference/docs/update.asciidoc @@ -4,7 +4,7 @@ The update API allows to update a document based on a script provided. The operation gets the document (collocated with the shard) from the index, runs the script (with optional script language and parameters), -and index back the result (also allows to delete, or ignore the +and indexes back the result (also allows to delete, or ignore the operation). It uses versioning to make sure no updates have happened during the "get" and "reindex". @@ -46,8 +46,8 @@ POST test/_update/1 // CONSOLE // TEST[continued] -We can add a tag to the list of tags (note, if the tag exists, it -will still add it, since it's a list): +We can add a tag to the list of tags (if the tag exists, it + still gets added, since this is a list): [source,js] -------------------------------------------------- @@ -88,7 +88,7 @@ POST test/_update/1 // TEST[continued] In addition to `_source`, the following variables are available through -the `ctx` map: `_index`, `_type`, `_id`, `_version`, `_routing` +the `ctx` map: `_index`, `_type`, `_id`, `_version`, `_routing`, and `_now` (the current timestamp). We can also add a new field to the document: @@ -116,7 +116,7 @@ POST test/_update/1 // TEST[continued] And, we can even change the operation that is executed. This example deletes -the doc if the `tags` field contain `green`, otherwise it does nothing +the doc if the `tags` field contains `green`, otherwise it does nothing (`noop`): [source,js] @@ -138,7 +138,7 @@ POST test/_update/1 [float] === Updates with a partial document -The update API also support passing a partial document, +The update API also supports passing a partial document, which will be merged into the existing document (simple recursive merge, inner merging of objects, replacing core "keys/values" and arrays). To fully replace the existing document, the <> should @@ -165,7 +165,7 @@ to put your field pairs of the partial document in the script itself. === Detecting noop updates If `doc` is specified its value is merged with the existing `_source`. -By default updates that don't change anything detect that they don't change anything and return "result": "noop" like this: +By default updates that don't change anything detect that they don't change anything and return `"result": "noop"` like this: [source,js] -------------------------------------------------- @@ -200,7 +200,7 @@ the request was ignored. -------------------------------------------------- // TESTRESPONSE -You can disable this behavior by setting "detect_noop": false like this: +You can disable this behavior by setting `"detect_noop": false` like this: [source,js] -------------------------------------------------- @@ -323,18 +323,18 @@ See <> for details. `refresh`:: Control when the changes made by this request are visible to search. See -<>. +<>. `_source`:: Allows to control if and how the updated source should be returned in the response. By default the updated source is not returned. -See <> for details. +See <> for details. `version`:: -The update API uses the Elasticsearch's versioning support internally to make +The update API uses the Elasticsearch versioning support internally to make sure the document doesn't change during the update. You can use the `version` parameter to specify that the document should only be updated if its version matches the one specified. @@ -343,7 +343,7 @@ matches the one specified. .The update API does not support versioning other than internal ===================================================== -External (version types `external` & `external_gte`) or forced (version type `force`) +External (version types `external` and `external_gte`) or forced (version type `force`) versioning is not supported by the update API as it would result in Elasticsearch version numbers being out of sync with the external system. Use the <> instead.