# Elasticseach failed shard allocation

**URL:** <https://discuss.elastic.co/t/elasticseach-failed-shard-allocation/271739>\
**Category:** Elasticsearch\
**Created:** [April 30, 2021, 6:23am UTC](https://discuss.elastic.co/t/elasticseach-failed-shard-allocation/271739 "2021-04-30T06:23:05Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheVintik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thevintik/32/60494_2.png) [@TheVintik](https://discuss.elastic.co/u/TheVintik)\
**Post date:** [April 30, 2021, 6:23am UTC](https://discuss.elastic.co/t/elasticseach-failed-shard-allocation/271739/1 "2021-04-30T06:23:05Z")

</div>

My ES is in yellow state after another one node adding and restarting cluster. I have 4 unassigned shards (from 33), and here is response for one of unassigned shards:

```
{
  "index" : "MY INDEX NAME",
  "shard" : 0,
  "primary" : false,
  "current_state" : "unassigned",
  "unassigned_info" : {
    "reason" : "ALLOCATION_FAILED",
    "at" : "2021-04-29TTIME",
    "failed_allocation_attempts" : 5,
    "details" : "failed shard on node [9yWBUCXXXTIIbiA]: failed to create index, failure IllegalArgumentException[IOException while reading synonyms_path_path: /etc/elasticsearch/synonyms.txt]; nested: NoSuchFileException[/etc/elasticsearch/synonyms.txt]; ",
    "last_allocation_status" : "no_attempt"
  },

```

How I can fix it?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 30, 2021, 6:34am UTC](https://discuss.elastic.co/t/elasticseach-failed-shard-allocation/271739/2 "2021-04-30T06:34:56Z")

</div>

You need to make sure that the synonym file is available on all machines.

---

<div class="post-metadata">

**Author:** ![TheVintik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thevintik/32/60494_2.png) [@TheVintik](https://discuss.elastic.co/u/TheVintik)\
**Post date:** [April 30, 2021, 6:45am UTC](https://discuss.elastic.co/t/elasticseach-failed-shard-allocation/271739/3 "2021-04-30T06:45:23Z")

</div>

Yeah, looks like this is the reason, new VM does not have this file.

Should I restart ES on all nodes after that? Or do something else?

---

<div class="post-metadata">

**Author:** ![TheVintik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thevintik/32/60494_2.png) [@TheVintik](https://discuss.elastic.co/u/TheVintik)\
**Post date:** [April 30, 2021, 6:57am UTC](https://discuss.elastic.co/t/elasticseach-failed-shard-allocation/271739/4 "2021-04-30T06:57:20Z")

</div>

@dadoonet add file and restarted ES, but looks like I need to run allocation again? Is it possible?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 30, 2021, 7:02am UTC](https://discuss.elastic.co/t/elasticseach-failed-shard-allocation/271739/5 "2021-04-30T07:02:06Z")

</div>

Did you restart everything? What is the error now?

---

<div class="post-metadata">

**Author:** ![TheVintik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thevintik/32/60494_2.png) [@TheVintik](https://discuss.elastic.co/u/TheVintik)\
**Post date:** [April 30, 2021, 7:07am UTC](https://discuss.elastic.co/t/elasticseach-failed-shard-allocation/271739/6 "2021-04-30T07:07:10Z")

</div>

1. Added missing file
2. Restarted ES
3. Run `POST /_cluster/reroute?retry_failed=true` to start again allocation (I used Kibana Dev Toosl)

@dadoonet thank you for your help!

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 30, 2021, 7:21am UTC](https://discuss.elastic.co/t/elasticseach-failed-shard-allocation/271739/7 "2021-04-30T07:21:31Z")

</div>

So it's all good now?

---

<div class="post-metadata">

**Author:** ![TheVintik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thevintik/32/60494_2.png) [@TheVintik](https://discuss.elastic.co/u/TheVintik)\
**Post date:** [April 30, 2021, 7:23am UTC](https://discuss.elastic.co/t/elasticseach-failed-shard-allocation/271739/8 "2021-04-30T07:23:44Z")

</div>

Yeah, after run `POST /_cluster/reroute?retry_failed=true` cluaster became green (after allocation)!

---

<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:** [May 28, 2021, 7:23am UTC](https://discuss.elastic.co/t/elasticseach-failed-shard-allocation/271739/9 "2021-05-28T07:23:54Z")

</div>

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