pending.asciidoc 3.1 KB

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