Unable to find any unassigned shards to explain

I am facing this error in Elasticsearch. Can someone help with this?

Below is the output for Elasticsearch APIs:
curl localhost:9200/_cluster/health

output:

{"cluster_name":"docker-cluster","status":"green","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":30,"active_shards":30,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":0,"delayed_unassigned_shards":0,"number_of_pending_tasks":0,"number_of_in_flight_fetch":0,"task_max_waiting_in_queue_millis":0,"active_shards_percent_as_number":100.0}



curl localhost:9200/_cat/shards?v

output:


index                             shard prirep state     docs   store ip         node
.watcher-history-11-2020.11.22    0     p      STARTED                172.29.0.2 03d0b7363967
.monitoring-es-7-2020.11.15       0     p      STARTED     68 463.2kb 172.29.0.2 03d0b7363967
.watcher-history-11-2020.11.25    0     p      STARTED                172.29.0.2 03d0b7363967
testelastic                       0     p      STARTED      0    208b 172.29.0.2 03d0b7363967
.watcher-history-11-2020.11.21    0     p      STARTED                172.29.0.2 03d0b7363967
.monitoring-es-7-2020.11.25       0     p      STARTED 127277  62.5mb 172.29.0.2 03d0b7363967
.monitoring-logstash-7-2020.11.21 0     p      STARTED 475746  71.1mb 172.29.0.2 03d0b7363967
.watcher-history-11-2020.11.23    0     p      STARTED                172.29.0.2 03d0b7363967
.monitoring-es-7-2020.11.24       0     p      STARTED 114223  64.3mb 172.29.0.2 03d0b7363967
.monitoring-es-7-2020.11.22       0     p      STARTED  17956    10mb 172.29.0.2 03d0b7363967
.watcher-history-11-2020.11.24    0     p      STARTED                172.29.0.2 03d0b7363967
.monitoring-alerts-7              0     p      STARTED     98  83.1kb 172.29.0.2 03d0b7363967
.monitoring-es-7-2020.11.17       0     p      STARTED  18052   8.6mb 172.29.0.2 03d0b7363967
.watches                          0     p      STARTED      6   3.4mb 172.29.0.2 03d0b7363967
.watcher-history-11-2020.11.19    0     p      STARTED                172.29.0.2 03d0b7363967
logstash-2020.11.17-000001        0     p      STARTED      0    208b 172.29.0.2 03d0b7363967
.monitoring-logstash-7-2020.11.20 0     p      STARTED 185437  28.3mb 172.29.0.2 03d0b7363967
.watcher-history-11-2020.11.17    0     p      STARTED                172.29.0.2 03d0b7363967
.monitoring-es-7-2020.11.26       0     p      STARTED  21229  12.5mb 172.29.0.2 03d0b7363967
.watcher-history-11-2020.11.26    0     p      STARTED                172.29.0.2 03d0b7363967
.watcher-history-11-2020.11.20    0     p      STARTED                172.29.0.2 03d0b7363967
ilm-history-2-000001              0     p      STARTED                172.29.0.2 03d0b7363967
.monitoring-es-7-2020.11.19       0     p      STARTED  56117  20.3mb 172.29.0.2 03d0b7363967
.triggered_watches                0     p      STARTED     22   781kb 172.29.0.2 03d0b7363967
.monitoring-es-7-2020.11.21       0     p      STARTED  48756  23.8mb 172.29.0.2 03d0b7363967
.monitoring-es-7-2020.11.20       0     p      STARTED  45360  20.9mb 172.29.0.2 03d0b7363967
.monitoring-es-7-2020.11.18       0     p      STARTED  63266  24.7mb 172.29.0.2 03d0b7363967
.monitoring-logstash-7-2020.11.22 0     p      STARTED  65242   8.6mb 172.29.0.2 03d0b7363967
.monitoring-es-7-2020.11.23       0     p      STARTED  99448  48.3mb 172.29.0.2 03d0b7363967
.monitoring-logstash-7-2020.11.17 0     p      STARTED    161 106.6kb 172.29.0.2 03d0b7363967



curl localhost:9200/_cluster/allocation/explain?pretty


output:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "unable to find any unassigned shards to explain [ClusterAllocationExplainRequest[useAnyUnassignedShard=true,includeYesDecisions?=false]"
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "unable to find any unassigned shards to explain [ClusterAllocationExplainRequest[useAnyUnassignedShard=true,includeYesDecisions?=false]"
  },
  "status" : 400
}

Hi,

According to the docs:

You can also have Elasticsearch explain the allocation of the first unassigned shard that it finds by sending an empty body for the request.

So, if you send an empty request body it tries to find an unallocated shard and fails. If you want to show allocation details for a specific shard you have to provide a body like this:

GET _cluster/allocation/explain?pretty
{
  "index": "heartbeat-7.6.0-2020.06.19-000005",
  "shard": 0,
  "primary": true
}

Best regards
Wolfram

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.