Skip to content

Commit 482719f

Browse files
Add link and missing content to update by query
1 parent 64abc0a commit 482719f

File tree

2 files changed

+26
-16
lines changed

2 files changed

+26
-16
lines changed

specification/_doc_ids/table.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,7 @@ test-grok-pattern,https://www.elastic.co/docs/api/doc/elasticsearch/operation/op
892892
time-value,https://github.com/elastic/elasticsearch/blob/current/libs/core/src/main/java/org/elasticsearch/core/TimeValue.java,
893893
time-zone-id,https://docs.oracle.com/javase/8/docs/api/java/time/ZoneId.html,
894894
trim-processor,https://www.elastic.co/docs/reference/enrich-processor/trim-processor,
895+
update-by-query,https://www.elastic.co/docs/reference/elasticsearch/rest-apis/update-by-query-api,
895896
update-dfanalytics,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ml-update-data-frame-analytics,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/update-dfanalytics.html
896897
update-desired-nodes,https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-cluster,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cluster.html
897898
update-license,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-license-post,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/update-license.html

specification/_global/update_by_query/UpdateByQueryRequest.ts

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,29 @@ import { Duration } from '@_types/Time'
5858
* A bulk update request is performed for each batch of matching documents.
5959
* Any query or update failures cause the update by query request to fail and the failures are shown in the response.
6060
* Any update requests that completed successfully still stick, they are not rolled back.
61+
*
62+
* **Refreshing shards**
63+
* Specifying the `refresh` parameter refreshes all shards once the request completes.
64+
* This is different than the update API's `refresh` parameter, which causes just the shard
65+
* that received the request to be refreshed. Unlike the update API, it does not support
66+
* `wait_for`.
67+
*
68+
* **Running update by query asynchronously**
69+
*
70+
* If the request contains `wait_for_completion=false`, Elasticsearch
71+
* performs some preflight checks, launches the request, and returns a
72+
* [task](https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-tasks) you can use to cancel or get the status of the task.
73+
* Elasticsearch creates a record of this task as a document at `.tasks/task/${taskId}`.
74+
*
75+
* **Waiting for active shards**
76+
*
77+
* `wait_for_active_shards` controls how many copies of a shard must be active
78+
* before proceeding with the request. See [`wait_for_active_shards`](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-create#operation-create-wait_for_active_shards)
79+
* for details. `timeout` controls how long each write request waits for unavailable
80+
* shards to become available. Both work exactly the way they work in the
81+
* [Bulk API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-bulk). Update by query uses scrolled searches, so you can also
82+
* specify the `scroll` parameter to control how long it keeps the search context
83+
* alive, for example `?scroll=10m`. The default is 5 minutes.
6184
*
6285
* **Throttling update requests**
6386
*
@@ -103,28 +126,14 @@ import { Duration } from '@_types/Time'
103126
* * Update performance scales linearly across available resources with the number of slices.
104127
*
105128
* Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources.
106-
*
107-
* **Update the document source**
108-
*
109-
* Update by query supports scripts to update the document source.
110-
* As with the update API, you can set `ctx.op` to change the operation that is performed.
111-
*
112-
* Set `ctx.op = "noop"` if your script decides that it doesn't have to make any changes.
113-
* The update by query operation skips updating the document and increments the `noop` counter.
114-
*
115-
* Set `ctx.op = "delete"` if your script decides that the document should be deleted.
116-
* The update by query operation deletes the document and increments the `deleted` counter.
117-
*
118-
* Update by query supports only `index`, `noop`, and `delete`.
119-
* Setting `ctx.op` to anything else is an error.
120-
* Setting any other field in `ctx` is an error.
121-
* This API enables you to only modify the source of matching documents; you cannot move them.
129+
* Refer to the linked documentation for examples of how to update documents using the `_update_by_query` API:
122130
* @rest_spec_name update_by_query
123131
* @availability stack since=2.4.0 stability=stable
124132
* @availability serverless stability=stable visibility=public
125133
* @index_privileges read,write
126134
* @doc_tag document
127135
* @doc_id docs-update-by-query
136+
* @ext_doc_id update-by-query
128137
*/
129138
export interface Request extends RequestBase {
130139
urls: [

0 commit comments

Comments
 (0)