You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add link to _update_by_query API examples (#4705) (#4773)
* Add link and missing content to update by query
* Update specification/_global/update_by_query/UpdateByQueryRequest.ts
(cherry picked from commit 30931cb)
Co-authored-by: Charlotte Hoblik <[email protected]>
Co-authored-by: Liam Thompson <[email protected]>
Copy file name to clipboardExpand all lines: specification/_global/update_by_query/UpdateByQueryRequest.ts
+26-16Lines changed: 26 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -59,6 +59,30 @@ import { Duration } from '@_types/Time'
59
59
* Any query or update failures cause the update by query request to fail and the failures are shown in the response.
60
60
* Any update requests that completed successfully still stick, they are not rolled back.
61
61
*
62
+
* **Refreshing shards**
63
+
*
64
+
* Specifying the `refresh` parameter refreshes all shards once the request completes.
65
+
* This is different to the update API's `refresh` parameter, which causes only the shard
66
+
* that received the request to be refreshed. Unlike the update API, it does not support
67
+
* `wait_for`.
68
+
*
69
+
* **Running update by query asynchronously**
70
+
*
71
+
* If the request contains `wait_for_completion=false`, Elasticsearch
72
+
* performs some preflight checks, launches the request, and returns a
73
+
* [task](https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-tasks) you can use to cancel or get the status of the task.
74
+
* Elasticsearch creates a record of this task as a document at `.tasks/task/${taskId}`.
75
+
*
76
+
* **Waiting for active shards**
77
+
*
78
+
* `wait_for_active_shards` controls how many copies of a shard must be active
79
+
* 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)
80
+
* for details. `timeout` controls how long each write request waits for unavailable
81
+
* shards to become available. Both work exactly the way they work in the
82
+
* [Bulk API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-bulk). Update by query uses scrolled searches, so you can also
83
+
* specify the `scroll` parameter to control how long it keeps the search context
84
+
* alive, for example `?scroll=10m`. The default is 5 minutes.
85
+
*
62
86
* **Throttling update requests**
63
87
*
64
88
* To control the rate at which update by query issues batches of update operations, you can set `requests_per_second` to any positive decimal number.
@@ -103,28 +127,14 @@ import { Duration } from '@_types/Time'
103
127
* * Update performance scales linearly across available resources with the number of slices.
104
128
*
105
129
* 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.
130
+
* Refer to the linked documentation for examples of how to update documents using the `_update_by_query` API:
0 commit comments