# Shard unassigned

**URL:** <https://discuss.elastic.co/t/shard-unassigned/237154>\
**Category:** Elasticsearch\
**Created:** [June 15, 2020, 2:32pm UTC](https://discuss.elastic.co/t/shard-unassigned/237154 "2020-06-15T14:32:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sahere37](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@sahere37](https://discuss.elastic.co/u/sahere37)\
**Post date:** [June 15, 2020, 2:32pm UTC](https://discuss.elastic.co/t/shard-unassigned/237154/1 "2020-06-15T14:32:54Z")

</div>

Hi all,  
My elasticsearch cluster health is red. in order to find reason following command has been ran:

```
`GET _cluster/allocation/explain

    {
      "index" : "mytweetindex",
      "shard" : 1,
      "primary" : true,
      "current_state" : "unassigned",
      "unassigned_info" : {
        "reason" : "CLUSTER_RECOVERED",
        "at" : "2020-06-14T13:39:13.479Z",
        "last_allocation_status" : "no_valid_shard_copy"
      },
      "can_allocate" : "no_valid_shard_copy",
      "allocate_explanation" : "cannot allocate because a previous copy of the primary shard existed but can no longer be found on the nodes in the cluster",
      "node_allocation_decisions" : [
        {
          "node_id" : "NGbarJGpQAS21fmW2aNfZw",
          "node_name" : "node-1",
          "transport_address" : "10.0.0.118:9300",
          "node_attributes" : {
            "ml.machine_memory" : "8589328384",
            "ml.max_open_jobs" : "20",
            "xpack.installed" : "true",
            "ml.enabled" : "true"
          },
          "node_decision" : "no",
          "store" : {
            "found" : false
          }
        },
        {
          "node_id" : "fzIrudooTo6RJmRgCMJU7Q",
          "node_name" : "node-2",
          "transport_address" : "10.0.0.117:9300",
          "node_attributes" : {
            "ml.machine_memory" : "8589328384",
            "ml.max_open_jobs" : "20",
            "xpack.installed" : "true",
            "ml.enabled" : "true"
          },
          "node_decision" : "no",
          "store" : {
            "found" : false
          }
        },
        {
          "node_id" : "v8T3-BfXTJmmjPPyCLqWaQ",
          "node_name" : "node-3",
          "transport_address" : "10.0.0.119:9300",
          "node_attributes" : {
            "ml.machine_memory" : "8589328384",
            "ml.max_open_jobs" : "20",
            "xpack.installed" : "true",
            "ml.enabled" : "true"
          },
          "node_decision" : "no",
          "store" : {
            "found" : false
          }
        }
      ]
    }

```

`

by searching following solution has been found:

```
POST /_cluster/reroute
{
	"commands" : [
 
    	{
      	"allocate_stale_primary" : {
            	"index" : "mytweetindex", "shard" : 1,
            	"node" : "node-1",
            	"accept_data_loss":"true"
      	}
    	}
	]
}

```

but when i check unassigned shards using following, still the index shard is unassigned

```
GET _cat/shards?h=index,shard,prirep,state,unassigned.reason| grep UNASSIGNED

mytweetindex 1 p UNASSIGNED
mytweetindex 1 r UNASSIGNED
mytweetindex 3 p STARTED
mytweetindex 3 r STARTED
mytweetindex 2 r STARTED
mytweetindex 2 p STARTED
mytweetindex 4 r STARTED
mytweetindex 4 p STARTED
mytweetindex 0 p STARTED
mytweetindex 0 r STARTED

```

Could you please advise me about this in order to handle this issue? many thanks.

---

<div class="post-metadata">

**Author:** ![KellyK313](https://avatars.discourse-cdn.com/v4/letter/k/13edae/32.png) [@KellyK313](https://discuss.elastic.co/u/KellyK313)\
**Post date:** [June 16, 2020, 2:42am UTC](https://discuss.elastic.co/t/shard-unassigned/237154/2 "2020-06-16T02:42:46Z")

</div>

try /reroute 'allocate\_empty\_primary'

---

<div class="post-metadata">

**Author:** ![sahere37](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@sahere37](https://discuss.elastic.co/u/sahere37)\
**Post date:** [June 16, 2020, 6:42am UTC](https://discuss.elastic.co/t/shard-unassigned/237154/3 "2020-06-16T06:42:52Z")

</div>

Dear KellyK313,  
Many thanks.  
The issue has been solved.  
Regards

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 14, 2020, 6:42am UTC](https://discuss.elastic.co/t/shard-unassigned/237154/4 "2020-07-14T06:42:58Z")

</div>

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