2013-11-29 02:21:26 -05:00
|
|
|
[[cluster-pending]]
|
2019-10-22 13:27:31 -04:00
|
|
|
=== Pending cluster tasks API
|
|
|
|
++++
|
|
|
|
<titleabbrev>Pending cluster tasks</titleabbrev>
|
|
|
|
++++
|
2013-11-29 02:21:26 -05:00
|
|
|
|
2019-08-08 08:48:18 -04:00
|
|
|
Returns cluster-level changes that have not yet been executed.
|
|
|
|
|
|
|
|
|
|
|
|
[[cluster-pending-api-request]]
|
|
|
|
==== {api-request-title}
|
|
|
|
|
|
|
|
`GET /_cluster/pending_tasks`
|
|
|
|
|
|
|
|
|
|
|
|
[[cluster-pending-api-desc]]
|
|
|
|
==== {api-description-title}
|
|
|
|
|
|
|
|
The pending cluster tasks API returns a list of any cluster-level changes (e.g.
|
|
|
|
create index, update mapping, allocate or fail shard) which have not yet been
|
|
|
|
executed.
|
2013-11-29 02:21:26 -05:00
|
|
|
|
2016-03-29 09:29:21 -04:00
|
|
|
NOTE: This API returns a list of any pending updates to the cluster state. These are distinct from the tasks reported by the
|
|
|
|
<<tasks,Task Management API>> which include periodic tasks and tasks initiated by the user, such as node stats, search queries, or create
|
|
|
|
index requests. However, if a user-initiated task such as a create index command causes a cluster state update, the activity of this task
|
|
|
|
might be reported by both task api and pending cluster tasks API.
|
|
|
|
|
2013-11-29 02:21:26 -05:00
|
|
|
|
2019-08-08 08:48:18 -04:00
|
|
|
[[cluster-pending-api-path-params]]
|
|
|
|
==== {api-path-parms-title}
|
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=local]
|
2019-08-08 08:48:18 -04:00
|
|
|
|
2020-06-01 19:42:53 -04:00
|
|
|
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=master-timeout]
|
2019-08-08 08:48:18 -04:00
|
|
|
|
|
|
|
|
|
|
|
[[cluster-pending-api-response-body]]
|
|
|
|
==== {api-response-body-title}
|
|
|
|
|
|
|
|
`tasks`::
|
|
|
|
(object) A list of pending tasks.
|
|
|
|
|
|
|
|
`insert_order`::
|
|
|
|
(integer) The number that represents when the task has been inserted into
|
|
|
|
the task queue.
|
|
|
|
|
|
|
|
`priority`::
|
|
|
|
(string) The priority of the pending task.
|
|
|
|
|
|
|
|
`source`::
|
|
|
|
(string) A general description of the cluster task that may include a reason
|
|
|
|
and origin.
|
|
|
|
|
|
|
|
`time_in_queue_millis`::
|
|
|
|
(integer) The time expressed in milliseconds since the task is waiting for
|
|
|
|
being performed.
|
|
|
|
|
|
|
|
`time_in_queue`::
|
|
|
|
(string) The time since the task is waiting for being performed.
|
|
|
|
|
|
|
|
|
|
|
|
[[cluster-pending-api-example]]
|
|
|
|
==== {api-examples-title}
|
|
|
|
|
|
|
|
Usually the request will return an empty list as cluster-level changes are fast.
|
|
|
|
However, if there are tasks queued up, the response will look similar like this:
|
2013-11-29 02:21:26 -05:00
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"tasks": [
|
|
|
|
{
|
|
|
|
"insert_order": 101,
|
|
|
|
"priority": "URGENT",
|
|
|
|
"source": "create-index [foo_9], cause [api]",
|
|
|
|
"time_in_queue_millis": 86,
|
|
|
|
"time_in_queue": "86ms"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"insert_order": 46,
|
|
|
|
"priority": "HIGH",
|
2015-06-23 16:10:55 -04:00
|
|
|
"source": "shard-started ([foo_2][1], node[tMTocMvQQgGCkj7QDHl3OA], [P], s[INITIALIZING]), reason [after recovery from shard_store]",
|
2013-11-29 02:21:26 -05:00
|
|
|
"time_in_queue_millis": 842,
|
|
|
|
"time_in_queue": "842ms"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"insert_order": 45,
|
|
|
|
"priority": "HIGH",
|
2015-06-23 16:10:55 -04:00
|
|
|
"source": "shard-started ([foo_2][0], node[tMTocMvQQgGCkj7QDHl3OA], [P], s[INITIALIZING]), reason [after recovery from shard_store]",
|
2013-11-29 02:21:26 -05:00
|
|
|
"time_in_queue_millis": 858,
|
|
|
|
"time_in_queue": "858ms"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
2017-08-30 03:30:36 -04:00
|
|
|
// NOTCONSOLE
|
|
|
|
// We can't test tasks output
|