pending.asciidoc 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. The valid priorities in descending priority order are: `IMMEDIATE` > `URGENT` > `HIGH` > `NORMAL` > `LOW` > `LANGUID`.
  36. `source`::
  37. (string) A general description of the cluster task that may include a reason
  38. and origin.
  39. `executing`::
  40. (boolean) True or false, indicating whether the pending tasks is currently getting executed or not.
  41. `time_in_queue_millis`::
  42. (integer) The time expressed in milliseconds since the task is waiting for
  43. being performed.
  44. `time_in_queue`::
  45. (string) The time since the task is waiting for being performed.
  46. [[cluster-pending-api-example]]
  47. ==== {api-examples-title}
  48. Usually the request will return an empty list as cluster-level changes are fast.
  49. However, if there are tasks queued up, the response will look similar like this:
  50. [source,js]
  51. --------------------------------------------------
  52. {
  53. "tasks": [
  54. {
  55. "insert_order": 101,
  56. "priority": "URGENT",
  57. "source": "create-index [foo_9], cause [api]",
  58. "executing" : true,
  59. "time_in_queue_millis": 86,
  60. "time_in_queue": "86ms"
  61. },
  62. {
  63. "insert_order": 46,
  64. "priority": "HIGH",
  65. "source": "shard-started ([foo_2][1], node[tMTocMvQQgGCkj7QDHl3OA], [P], s[INITIALIZING]), reason [after recovery from shard_store]",
  66. "executing" : false,
  67. "time_in_queue_millis": 842,
  68. "time_in_queue": "842ms"
  69. },
  70. {
  71. "insert_order": 45,
  72. "priority": "HIGH",
  73. "source": "shard-started ([foo_2][0], node[tMTocMvQQgGCkj7QDHl3OA], [P], s[INITIALIZING]), reason [after recovery from shard_store]",
  74. "executing" : false,
  75. "time_in_queue_millis": 858,
  76. "time_in_queue": "858ms"
  77. }
  78. ]
  79. }
  80. --------------------------------------------------
  81. // NOTCONSOLE
  82. // We can't test tasks output