pending.asciidoc 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. [[cluster-pending]]
  2. === Pending cluster tasks API
  3. ++++
  4. <titleabbrev>Pending cluster tasks</titleabbrev>
  5. ++++
  6. Returns cluster-level changes that have not yet been executed.
  7. [[cluster-pending-api-request]]
  8. ==== {api-request-title}
  9. `GET /_cluster/pending_tasks`
  10. [[cluster-pending-api-desc]]
  11. ==== {api-description-title}
  12. The pending cluster tasks API returns a list of any cluster-level changes (e.g.
  13. create index, update mapping, allocate or fail shard) which have not yet been
  14. executed.
  15. NOTE: This API returns a list of any pending updates to the cluster state. These are distinct from the tasks reported by the
  16. <<tasks,Task Management API>> which include periodic tasks and tasks initiated by the user, such as node stats, search queries, or create
  17. index requests. However, if a user-initiated task such as a create index command causes a cluster state update, the activity of this task
  18. might be reported by both task api and pending cluster tasks API.
  19. [[cluster-pending-api-path-params]]
  20. ==== {api-path-parms-title}
  21. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=local]
  22. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=master-timeout]
  23. [[cluster-pending-api-response-body]]
  24. ==== {api-response-body-title}
  25. `tasks`::
  26. (object) A list of pending tasks.
  27. `insert_order`::
  28. (integer) The number that represents when the task has been inserted into
  29. the task queue.
  30. `priority`::
  31. (string) The priority of the pending task.
  32. `source`::
  33. (string) A general description of the cluster task that may include a reason
  34. and origin.
  35. `time_in_queue_millis`::
  36. (integer) The time expressed in milliseconds since the task is waiting for
  37. being performed.
  38. `time_in_queue`::
  39. (string) The time since the task is waiting for being performed.
  40. [[cluster-pending-api-example]]
  41. ==== {api-examples-title}
  42. Usually the request will return an empty list as cluster-level changes are fast.
  43. However, if there are tasks queued up, the response will look similar like this:
  44. [source,js]
  45. --------------------------------------------------
  46. {
  47. "tasks": [
  48. {
  49. "insert_order": 101,
  50. "priority": "URGENT",
  51. "source": "create-index [foo_9], cause [api]",
  52. "time_in_queue_millis": 86,
  53. "time_in_queue": "86ms"
  54. },
  55. {
  56. "insert_order": 46,
  57. "priority": "HIGH",
  58. "source": "shard-started ([foo_2][1], node[tMTocMvQQgGCkj7QDHl3OA], [P], s[INITIALIZING]), reason [after recovery from shard_store]",
  59. "time_in_queue_millis": 842,
  60. "time_in_queue": "842ms"
  61. },
  62. {
  63. "insert_order": 45,
  64. "priority": "HIGH",
  65. "source": "shard-started ([foo_2][0], node[tMTocMvQQgGCkj7QDHl3OA], [P], s[INITIALIZING]), reason [after recovery from shard_store]",
  66. "time_in_queue_millis": 858,
  67. "time_in_queue": "858ms"
  68. }
  69. ]
  70. }
  71. --------------------------------------------------
  72. // NOTCONSOLE
  73. // We can't test tasks output