pending.asciidoc 2.9 KB

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