Throttle a reindex operation
- POST /_reindex/{task_id}/_rethrottle
Change the maximum number of documents to index per second for a particular reindex operation. For example, to unthrottle to unlimited documents per second:
POST _reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1
Rethrottling that speeds up the query takes effect immediately. Rethrottling that slows down the query will take effect after completing the current batch of documents. This behavior prevents scroll timeouts.
This API follows reindex tasks across node-shutdown relocations, so callers can keep using the original task ID throughout the lifetime of the operation. The relocated task ID is also accepted and is followed transparently. In either case, returned task IDs and timings reflect the original task, not its relocated successor.
The rethrottle may not have been applied to any tasks if either node_failures or task_failures are non-empty, or if the response contains
no successfully rethrottled tasks — that is, no entries under nodes (returned with the default
group_by=nodes in stack) or under tasks (returned in serverless, or in stack with
group_by=none or group_by=parents).
Path Parameters
-
task_idstring Idrequired -
The task identifier, returned when creating a reindex task, or by listing tasks via
GET /_reindexorGET /_tasks. In stack, can be either the original task ID or the task ID of the relocated task.
Query Parameters
-
requests_per_secondnumberrequired The maximum number of documents to index per second, across the entire reindex operation (including slices). It can be either
-1to turn off throttling or any decimal number like1.7or12to throttle to that level.-
group_byGroupBy · default: nodes The way to group the tasks in the response. We recommend setting this to
none, which provides the cleanest response format.Supported values include:
nodes: Group tasks by node ID.parents: Group tasks by parent task ID.none: Do not group tasks.
-
Values:
nodesparentsnone
Response
-
node_failuresErrorCause -
Node-level failures encountered while applying the rethrottle request. Will return a
failed_node_exceptionwrapping ano_such_node_exception, if a node handling the task either never existed, or has left the cluster, and one of the following is true:- The task has completed.
- The task cannot be found.
Note: Rethrottle handles relocations, so it should succeed if the task can be found and has not completed.
-
typestringrequired -
The type of error
-
reasonstringnullable -
A human-readable explanation of the error, in English.
-
stack_tracestring -
The server stack trace. Present only if the
error_trace=trueparameter was sent with the request. -
caused_byErrorCause -
root_causeErrorCause -
suppressedErrorCause -
task_failuresTaskFailure -
Per-task failures encountered while applying the rethrottle. If a rethrottle is attempted during a relocation handoff, the failure object reports
status: SERVICE_UNAVAILABLE(the HTTP response itself is still200 OK). In this case, the request can be retried until success. -
task_idnumberrequired -
node_idstringrequired -
statusstringrequired -
reasonErrorCauserequired -
typestringrequired -
The type of error
-
reasonstringnullable -
A human-readable explanation of the error, in English.
-
stack_tracestring -
The server stack trace. Present only if the
error_trace=trueparameter was sent with the request. -
caused_byErrorCause -
root_causeErrorCause -
suppressedErrorCause -
nodesmap string to ReindexNode -
Tasks grouped by node, returned only when
group_by=nodes(the default). -
<string>ReindexNode -
attributesmap string to stringrequired -
hoststringrequired -
ipstringrequired -
namestring Namerequired -
rolesNodeRoles -
Values:
masterdatadata_colddata_contentdata_frozendata_hotdata_warmclientingestmlvoting_onlytransformremote_cluster_clientcoordinating_only -
transport_addressstringrequired -
tasksmap string to ReindexTaskrequired -
<string>ReindexTask -
actionstringrequired -
cancellablebooleanrequired -
cancelledbooleanrequired -
descriptionstringrequired -
idnumberrequired -
nodestring Namerequired -
running_time_in_nanosDurationValueUnitNanosrequired -
start_time_in_millisEpochTimeUnitMillisrequired -
statusParentReindexStatusrequired -
slicesReindexStatus -
slice_idnumber -
The slice ID
-
batchesnumberrequired -
The number of scroll responses pulled back by the reindex.
-
creatednumber -
The number of documents that were successfully created.
-
deletednumberrequired -
The number of documents that were successfully deleted.
-
noopsnumberrequired -
The number of documents that were ignored because the script used for the reindex returned a
noopvalue forctx.op. -
requests_per_secondnumberrequired -
The number of requests per second effectively executed during the reindex.
-
retriesRetriesrequired -
The number of retries attempted by reindex.
bulkis the number of bulk actions retried andsearchis the number of search actions retried. -
throttledstring Duration -
throttled_millisDurationValueUnitMillisrequired -
Number of milliseconds the request slept to conform to
requests_per_second. -
throttled_untilstring Duration -
throttled_until_millisDurationValueUnitMillisrequired -
This field should always be equal to zero in a
_reindexresponse. It only has meaning when using the Task API, where it indicates the next time (in milliseconds since epoch) a throttled request will be executed again in order to conform torequests_per_second. -
totalnumberrequired -
The number of documents that were successfully processed.
-
updatednumber -
The number of documents that were successfully updated, for example, a document with same ID already existed prior to reindex updating it.
-
version_conflictsnumberrequired -
The number of version conflicts that reindex hits.
-
cancelledstring -
The reason for cancellation if the slice was canceled
-
slice_idnumber -
The slice ID
-
batchesnumberrequired -
The number of scroll responses pulled back by the reindex.
-
creatednumber -
The number of documents that were successfully created.
-
deletednumberrequired -
The number of documents that were successfully deleted.
-
noopsnumberrequired -
The number of documents that were ignored because the script used for the reindex returned a
noopvalue forctx.op. -
requests_per_secondnumberrequired -
The number of requests per second effectively executed during the reindex.
-
retriesRetriesrequired -
The number of retries attempted by reindex.
bulkis the number of bulk actions retried andsearchis the number of search actions retried. -
throttledstring Duration -
throttled_millisDurationValueUnitMillisrequired -
Number of milliseconds the request slept to conform to
requests_per_second. -
throttled_untilstring Duration -
throttled_until_millisDurationValueUnitMillisrequired -
This field should always be equal to zero in a
_reindexresponse. It only has meaning when using the Task API, where it indicates the next time (in milliseconds since epoch) a throttled request will be executed again in order to conform torequests_per_second. -
totalnumberrequired -
The number of documents that were successfully processed.
-
updatednumber -
The number of documents that were successfully updated, for example, a document with same ID already existed prior to reindex updating it.
-
version_conflictsnumberrequired -
The number of version conflicts that reindex hits.
-
cancelledstring -
The reason for cancellation if the slice was canceled
-
typestringrequired -
headersHttpHeadersrequired -
tasksReindexTasks -
The tasks that were successfully rethrottled. Always returned in serverless. Returned with
group_by=noneorgroup_by=parentsin stack.