企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# Pending cluster tasks 原文链接 : [https://www.elastic.co/guide/en/elasticsearch/reference/5.0/cluster-pending.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/cluster-pending.html) 译文链接 : [http://www.apache.wiki/display/Elasticsearch/Pending+cluster+tasks](http://www.apache.wiki/display/Elasticsearch/Pending+cluster+tasks) 贡献者 : [那伊抹微笑](/display/~wangyangting) **pending cluster tasks**(添加集群任务)**API** 返回一个集群级别中还没有被执行的操作的列表(例如,创建索引,更新映射,分配或故障的分片)。 注意 : 该 **API** 返回一个正在添加到更新集群状态的任务列表。这些是通过 [Task Management API](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/tasks.html "Task Management API") 从任务报告的。它包括了由用户发起的周期性任务和定期任务,例如节点状态,搜索查询,或者创建索引请求。然后,如果用户初始化任务(像创建索引命令)会造成集群状态更新,该任务的活动可能由 **task api** 和 **pending cluster tasks API** 来报告。 ``` $ curl -XGET 'http://localhost:9200/_cluster/pending_tasks' ``` 通常这个操作会返回一个空的列表,因为集群中的变化通常是很快的。然而如果有任务在队列中,该输出可能如下 :  ``` { "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" } ] } ```