# How to fix UNASSIGNED shard in Elasticsearch

**URL:** https://discuss.elastic.co/t/how-to-fix-unassigned-shard-in-elasticsearch/29257
**Category:** Elasticsearch
**Created:** [September 14, 2015, 3:06pm UTC](https://discuss.elastic.co/t/how-to-fix-unassigned-shard-in-elasticsearch/29257 "2015-09-14T15:06:44Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Fernando\_Gamboa](https://avatars.discourse-cdn.com/v4/letter/f/cc9497/32.png) [@Fernando\_Gamboa](https://discuss.elastic.co/u/Fernando_Gamboa)
#### Post date: [September 14, 2015, 3:06pm UTC](https://discuss.elastic.co/t/how-to-fix-unassigned-shard-in-elasticsearch/29257/1 "2015-09-14T15:06:45Z")

</div>

While monitoring Elasticsearch logs it was observed a shard failure, please see below:

The cluster (1 nodes) is in red state and while troubleshooting this it was found via curl localhost:9200/\_cat/shards 1 unassigned shard (logstash-2015.09.08 0 p UNASSIGNED)

Is there any well known operational procedure to fix this shard/index issue?

I am using  
elasticsearch-1.5.2-1.noarch  
logstash-1.5.3-1.noarch  
logstash-forwarder-0.4.0-1.x86\_64

[2015-09-14 10:43:32,566][WARN][cluster.action.shard] [aws\_elk\_01] [logstash-2015.09.08][0] received shard failed for [logstash-2015.09.08][0], node[-bcyalWpTKy1wMRQnfW7uA], [P], s[INITIALIZING], indexUUID [U59vyxSySz6mPZrsh7lpUg], reason [shard failure [failed recovery][IndexShardGatewayRecoveryException[[logstash-2015.09.08][0] failed recovery]; nested: EngineCreationFailureException[[logstash-2015.09.08][0] failed to upgrade 3x segments]; nested: EOFException[read past EOF: NIOFSIndexInput(path="/var/elasticdata/elasticaws/nodes/0/indices/logstash-2015.09.08/0/index/segments\_u")]; ]]  
[2015-09-14 10:43:42,567][WARN][indices.cluster] [aws\_elk\_01] [[logstash-2015.09.08][0]] marking and sending shard failed due to [failed recovery]  
org.elasticsearch.index.gateway.IndexShardGatewayRecoveryException: [logstash-2015.09.08][0] failed recovery  
at org.elasticsearch.index.gateway.IndexShardGatewayService$1.run(IndexShardGatewayService.java:162)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)  
at java.lang.Thread.run(Thread.java:745)  
Caused by: org.elasticsearch.index.engine.EngineCreationFailureException: [logstash-2015.09.08][0] failed to upgrade 3x segments  
at org.elasticsearch.index.engine.InternalEngine.(InternalEngine.java:121)  
at org.elasticsearch.index.engine.InternalEngineFactory.newReadWriteEngine(InternalEngineFactory.java:32)  
at org.elasticsearch.index.shard.IndexShard.newEngine(IndexShard.java:1262)  
at org.elasticsearch.index.shard.IndexShard.createNewEngine(IndexShard.java:1257)  
at org.elasticsearch.index.shard.IndexShard.prepareForTranslogRecovery(IndexShard.java:784)  
at org.elasticsearch.index.gateway.local.LocalIndexShardGateway.recover(LocalIndexShardGateway.java:226)  
at org.elasticsearch.index.gateway.IndexShardGatewayService$1.run(IndexShardGatewayService.java:112)  
... 3 more  
Caused by: java.io.EOFException: read past EOF: NIOFSIndexInput(path="/var/elasticdata/elasticaws/nodes/0/indices/logstash-2015.09.08/0/index/segments\_u")  
at org.apache.lucene.store.BufferedIndexInput.refill(BufferedIndexInput.java:336)  
at org.apache.lucene.store.BufferedIndexInput.readByte(BufferedIndexInput.java:54)  
at org.apache.lucene.store.DataInput.readInt(DataInput.java:98)  
at org.apache.lucene.store.BufferedIndexInput.readInt(BufferedIndexInput.java:183)  
at org.elasticsearch.common.lucene.Lucene.indexNeeds3xUpgrading(Lucene.java:767)  
at org.elasticsearch.common.lucene.Lucene.upgradeLucene3xSegmentsMetadata(Lucene.java:778)  
at org.elasticsearch.index.engine.InternalEngine.upgrade3xSegments(InternalEngine.java:1084)  
at org.elasticsearch.ind

All the best,  
Carlos

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [September 15, 2015, 9:56pm UTC](https://discuss.elastic.co/t/how-to-fix-unassigned-shard-in-elasticsearch/29257/2 "2015-09-15T21:56:07Z")

</div>

Did this index come from an older cluster?

---

<div class="post-metadata">

### Author: ![Fernando\_Gamboa](https://avatars.discourse-cdn.com/v4/letter/f/cc9497/32.png) [@Fernando\_Gamboa](https://discuss.elastic.co/u/Fernando_Gamboa)
#### Post date: [September 15, 2015, 11:36pm UTC](https://discuss.elastic.co/t/how-to-fix-unassigned-shard-in-elasticsearch/29257/3 "2015-09-15T23:36:08Z")

</div>

Hi

No. Only this index/shard was affected.  
I had fixed by doing this  
curl -XPOST -d '{ "commands" : [{ "allocate" : { "index" : "logstash-2015.09.08", "shard" : 0, "node" : "aws\_elk\_01", "allow\_primary" : true } }] }' [http://localhost:9200/\_cluster/reroute?pretty](http://localhost:9200/_cluster/reroute?pretty)

Thank you for your input,

Carlos Fernando

---

<div class="post-metadata">

### Author: ![gphadke](https://avatars.discourse-cdn.com/v4/letter/g/ecc23a/32.png) [@gphadke](https://discuss.elastic.co/u/gphadke)
#### Post date: [November 6, 2015, 1:48pm UTC](https://discuss.elastic.co/t/how-to-fix-unassigned-shard-in-elasticsearch/29257/4 "2015-11-06T13:48:46Z")

</div>

I am having same problem, any idea why this happens?

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [November 8, 2015, 9:34pm UTC](https://discuss.elastic.co/t/how-to-fix-unassigned-shard-in-elasticsearch/29257/5 "2015-11-08T21:34:54Z")

</div>

Please start your own thread.

---

<div class="post-metadata">

### Author: ![Fernando\_Gamboa](https://avatars.discourse-cdn.com/v4/letter/f/cc9497/32.png) [@Fernando\_Gamboa](https://discuss.elastic.co/u/Fernando_Gamboa)
#### Post date: [November 9, 2015, 12:47am UTC](https://discuss.elastic.co/t/how-to-fix-unassigned-shard-in-elasticsearch/29257/6 "2015-11-09T00:47:43Z")

</div>

Hi,

No. Not clear to me why this happened. However after forcing the cluster to use the index with existing copy (as previously reported) not related issues have been observed.

Is it something that is happening to you recurrently?

All the best,  
Carlos Fernando

---

<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 5, 2017, 11:39pm UTC](https://discuss.elastic.co/t/how-to-fix-unassigned-shard-in-elasticsearch/29257/7 "2017-07-05T23:39:54Z")

</div>


