2018-10-29 10:32:17 -04:00
|
|
|
--
|
|
|
|
:api: rethrottle
|
|
|
|
:request: RethrottleRequest
|
|
|
|
:response: ListTasksResponse
|
|
|
|
--
|
|
|
|
|
|
|
|
[id="{upid}-{api}"]
|
2018-10-02 15:44:15 -04:00
|
|
|
=== Rethrottle API
|
2018-09-20 12:56:12 -04:00
|
|
|
|
2018-10-29 10:32:17 -04:00
|
|
|
[id="{upid}-{api}-request"]
|
2018-10-02 15:44:15 -04:00
|
|
|
==== Rethrottle Request
|
2018-09-20 12:56:12 -04:00
|
|
|
|
2018-10-29 10:32:17 -04:00
|
|
|
A +{request}+ can be used to change the current throttling on a running
|
2018-10-02 15:44:15 -04:00
|
|
|
reindex, update-by-query or delete-by-query task or to disable throttling of
|
|
|
|
the task entirely. It requires the task Id of the task to change.
|
2018-09-20 12:56:12 -04:00
|
|
|
|
|
|
|
In its simplest form, you can use it to disable throttling of a running
|
2018-10-02 15:44:15 -04:00
|
|
|
task using the following:
|
2018-09-20 12:56:12 -04:00
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-10-29 10:32:17 -04:00
|
|
|
include-tagged::{doc-tests-file}[{api}-disable-request]
|
2018-09-20 12:56:12 -04:00
|
|
|
--------------------------------------------------
|
2018-10-29 10:32:17 -04:00
|
|
|
<1> Create a +{request}+ that disables throttling for a specific task id
|
2018-09-20 12:56:12 -04:00
|
|
|
|
|
|
|
By providing a `requestsPerSecond` argument, the request will change the
|
|
|
|
existing task throttling to the specified value:
|
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-10-29 10:32:17 -04:00
|
|
|
include-tagged::{doc-tests-file}[{api}-request]
|
2018-09-20 12:56:12 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
<1> Request to change the throttling of a task to 100 requests per second
|
|
|
|
|
2018-10-02 15:44:15 -04:00
|
|
|
The rethrottling request can be executed by using one of the three appropriate
|
|
|
|
methods depending on whether a reindex, update-by-query or delete-by-query task
|
|
|
|
should be rethrottled:
|
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-10-29 10:32:17 -04:00
|
|
|
include-tagged::{doc-tests-file}[{api}-request-execution]
|
2018-10-02 15:44:15 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
<1> Execute reindex rethrottling request
|
|
|
|
<2> The same for update-by-query
|
|
|
|
<3> The same for delete-by-query
|
|
|
|
|
2018-10-29 10:32:17 -04:00
|
|
|
[id="{upid}-{api}-async"]
|
2018-09-20 12:56:12 -04:00
|
|
|
==== Asynchronous Execution
|
|
|
|
|
2018-10-29 10:32:17 -04:00
|
|
|
The asynchronous execution of a rethrottle request requires both the +{request}+
|
2018-09-20 12:56:12 -04:00
|
|
|
instance and an `ActionListener` instance to be passed to the asynchronous
|
|
|
|
method:
|
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-10-29 10:32:17 -04:00
|
|
|
include-tagged::{doc-tests-file}[{api}-execute-async]
|
2018-09-20 12:56:12 -04:00
|
|
|
--------------------------------------------------
|
2018-10-02 15:44:15 -04:00
|
|
|
<1> Execute reindex rethrottling asynchronously
|
|
|
|
<2> The same for update-by-query
|
|
|
|
<3> The same for delete-by-query
|
2018-09-20 12:56:12 -04:00
|
|
|
|
|
|
|
The asynchronous method does not block and returns immediately.
|
|
|
|
Once it is completed the `ActionListener` is called back using the `onResponse` method
|
|
|
|
if the execution successfully completed or using the `onFailure` method if
|
|
|
|
it failed. A typical listener looks like this:
|
|
|
|
|
|
|
|
["source","java",subs="attributes,callouts,macros"]
|
|
|
|
--------------------------------------------------
|
2018-10-29 10:32:17 -04:00
|
|
|
include-tagged::{doc-tests-file}[{api}-request-async-listener]
|
2018-09-20 12:56:12 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
<1> Code executed when the request is successfully completed
|
|
|
|
<2> Code executed when the request fails with an exception
|
|
|
|
|
2018-10-29 10:32:17 -04:00
|
|
|
[id="{upid}-{api}-response"]
|
2018-09-20 12:56:12 -04:00
|
|
|
==== Rethrottle Response
|
|
|
|
|
2018-10-29 10:32:17 -04:00
|
|
|
Rethrottling returns the task that has been rethrottled in the form of a
|
|
|
|
+{response}+. The structure of this response object is described in detail
|
2018-09-20 12:56:12 -04:00
|
|
|
in <<java-rest-high-cluster-list-tasks-response,this section>>.
|