| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 | [[java-rest-high-tasks-list]]=== List Tasks APIThe List Tasks API allows to get information about the tasks currently executing in the cluster.[[java-rest-high-cluster-list-tasks-request]]==== List Tasks RequestA `ListTasksRequest`:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/TasksClientDocumentationIT.java[list-tasks-request]--------------------------------------------------There is no required parameters. By default the client will list all tasks and will not waitfor task completion.==== Parameters["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/TasksClientDocumentationIT.java[list-tasks-request-filter]--------------------------------------------------<1> Request only cluster-related tasks<2> Request all tasks running on nodes nodeId1 and nodeId2<3> Request only children of a particular task["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/TasksClientDocumentationIT.java[list-tasks-request-detailed]--------------------------------------------------<1> Should the information include detailed, potentially slow to generate data. Defaults to `false`["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/TasksClientDocumentationIT.java[list-tasks-request-wait-completion]--------------------------------------------------<1> Should this request wait for all found tasks to complete. Defaults to `false`<2> Timeout for the request as a `TimeValue`. Applicable only if `setWaitForCompletion` is `true`.Defaults to 30 seconds<3> Timeout as a `String`[[java-rest-high-cluster-list-tasks-sync]]==== Synchronous Execution["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/TasksClientDocumentationIT.java[list-tasks-execute]--------------------------------------------------[[java-rest-high-cluster-list-tasks-async]]==== Asynchronous ExecutionThe asynchronous execution of a cluster update settings requires both the`ListTasksRequest` instance and an `ActionListener` instance to bepassed to the asynchronous method:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/TasksClientDocumentationIT.java[list-tasks-execute-async]--------------------------------------------------<1> The `ListTasksRequest` to execute and the `ActionListener` to usewhen the execution completesThe asynchronous method does not block and returns immediately. Once it iscompleted the `ActionListener` is called back using the `onResponse` methodif the execution successfully completed or using the `onFailure` method ifit failed.A typical listener for `ListTasksResponse` looks like:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/TasksClientDocumentationIT.java[list-tasks-execute-listener]--------------------------------------------------<1> Called when the execution is successfully completed. The response isprovided as an argument<2> Called in case of a failure. The raised exception is provided as an argument[[java-rest-high-cluster-list-tasks-response]]==== List Tasks Response["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/TasksClientDocumentationIT.java[list-tasks-response-tasks]--------------------------------------------------<1> List of currently running tasks["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/TasksClientDocumentationIT.java[list-tasks-response-calc]--------------------------------------------------<1> List of tasks grouped by a node<2> List of tasks grouped by a parent task["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/TasksClientDocumentationIT.java[list-tasks-response-failures]--------------------------------------------------<1> List of node failures<2> List of tasks failures
 |