pending.asciidoc 3.6 KB

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