Got it

Pending cluster tasks API in Elasticsearch

Latest reply: Nov 21, 2021 15:42:00 397 2 2 0 0

Hello all, 

This case mainly talks about "Pending cluster tasks API in Elasticsearch".

Returns cluster-level changes that have not yet been executed.


GET /_cluster/pending_tasks


If the Elasticsearch security features are enabled, you must have the monitor or manage cluster privilege to use this API.


The pending cluster tasks API returns a list of any cluster-level changes (e.g. create index, update mapping, allocate or fail shard) which have not yet been executed.

This API returns a list of any pending updates to the cluster state. These are distinct from the tasks reported by the Task Management API which include periodic tasks and tasks initiated by the user, such as node stats, search queries, or create index requests. However, if a user-initiated task such as a create index command causes a cluster state update, the activity of this task might be reported by both task api and pending cluster tasks API.

Path parameters


  • (Optional, Boolean) If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node.


  • (Optional, time units) Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Defaults to 30s.

Response body


  • (object) A list of pending tasks.


  • (integer) The number that represents when the task has been inserted into the task queue.


  • (string) The priority of the pending task.


  • (string) A general description of the cluster task that may include a reason and origin.


  • (integer) The time expressed in milliseconds since the task is waiting for being performed.


  • (string) The time since the task is waiting for being performed.


Usually the request will return an empty list as cluster-level changes are fast. However, if there are tasks queued up, the response will look similar like this:

   "tasks": [
         "insert_order": 101,
         "priority": "URGENT",
         "source": "create-index [foo_9], cause [api]",
         "time_in_queue_millis": 86,
         "time_in_queue": "86ms"
         "insert_order": 46,
         "priority": "HIGH",
         "source": "shard-started ([foo_2][1], node[tMTocMvQQgGCkj7QDHl3OA], [P], s[INITIALIZING]), reason [after recovery from shard_store]",
         "time_in_queue_millis": 842,
         "time_in_queue": "842ms"
         "insert_order": 45,
         "priority": "HIGH",
         "source": "shard-started ([foo_2][0], node[tMTocMvQQgGCkj7QDHl3OA], [P], s[INITIALIZING]), reason [after recovery from shard_store]",
         "time_in_queue_millis": 858,
         "time_in_queue": "858ms"

That's all, thanks!

  • x
  • convention:

Admin Created Nov 15, 2021 03:29:50

Thanks for your sharing!
View more
  • x
  • convention:

Created Nov 21, 2021 15:42:00

Thanks for sharing this post
View more
  • x
  • convention:


You need to log in to comment to the post Login | Register

Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " User Agreement."

My Followers

Login and enjoy all the member benefits


Are you sure to block this user?
Users on your blacklist cannot comment on your post,cannot mention you, cannot send you private messages.
Please bind your phone number to obtain invitation bonus.
Information Protection Guide
Thanks for using Huawei Enterprise Support Community! We will help you learn how we collect, use, store and share your personal information and the rights you have in accordance with Privacy Policy and User Agreement.