Way to list reason shard is unassigned or unallocated?

I can't find a way to enumerate the reason(s) why a shard can't be assigned or allocated other than attempting a reroute:

$ curl -X POST https://$HOSTNAME/es/_cluster/reroute?pretty -d '{"commands":[{"allocate":{"index":"logstash-2016.01","shard":0,"node":"data-6","allow_primary":1}}]}'
{
  "error" : {
    "root_cause" : [ {
      "type" : "remote_transport_exception",
      "reason" : "[master-8][1.2.3.4:9300][cluster:admin/reroute]"
    } ],
    "type" : "illegal_argument_exception",
    "reason" : "[allocate] allocation of [logstash-2016.01][0] on node {data-6}{oAPyE7RQSfyA8aX8GsfiPw}{1.2.3.6}{1.2.3.6:9300}{temp=hot, master=false} is not allowed, reason: [YES(below primary recovery limit of [4])][YES(allocation disabling is ignored)][YES(shard count under index limit [3] and node limit [-1] of total shards per node)][NO(node does not match index required filters [temp:\"warm\"])][YES(no allocation awareness enabled)][YES(primary shard can be allocated anywhere)][YES(no snapshots are currently running)][YES(allocation disabling is ignored)][YES(shard is primary)][YES(shard is not allocated to same node or host)][YES(enough disk for shard on node, free: [822.4gb])]"
  },
  "status" : 400
}

I was hoping to see it via the /_cat/shards api but it's empty:

$ curl https://$HOSTNAME/es/_cat/shards/logstash-2016.01?v\&h=index,shard,state,unassigned.reason,unassigned.details
index         shard state      unassigned.reason unassigned.details
abuse-2016.01 1     UNASSIGNED INDEX_REOPENED
abuse-2016.01 2     UNASSIGNED INDEX_REOPENED
abuse-2016.01 0     UNASSIGNED INDEX_REOPENED

Anyone know of an api that will expose the reason as detailed via the reroute response? Thanks!

1 Like

It is available in 5.0.0-alpha1:

2 Likes

It just occurred to me that the reason is a function of a particular node which explains why /_cat/shards won't know. Thanks for the link. That feature will be much appreciated.

1 Like