How to fix UNASSIGNED shard in Elasticsearch

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

[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$
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$
Caused by: org.elasticsearch.index.engine.EngineCreationFailureException: [logstash-2015.09.08][0] failed to upgrade 3x segments
at org.elasticsearch.index.engine.InternalEngine.(
at org.elasticsearch.index.engine.InternalEngineFactory.newReadWriteEngine(
at org.elasticsearch.index.shard.IndexShard.newEngine(
at org.elasticsearch.index.shard.IndexShard.createNewEngine(
at org.elasticsearch.index.shard.IndexShard.prepareForTranslogRecovery(
at org.elasticsearch.index.gateway.local.LocalIndexShardGateway.recover(
at org.elasticsearch.index.gateway.IndexShardGatewayService$
... 3 more
Caused by: read past EOF: NIOFSIndexInput(path="/var/elasticdata/elasticaws/nodes/0/indices/logstash-2015.09.08/0/index/segments_u")
at org.elasticsearch.common.lucene.Lucene.indexNeeds3xUpgrading(
at org.elasticsearch.common.lucene.Lucene.upgradeLucene3xSegmentsMetadata(
at org.elasticsearch.index.engine.InternalEngine.upgrade3xSegments(
at org.elasticsearch.ind

All the best,

1 Like

Did this index come from an older cluster?


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

Thank you for your input,

Carlos Fernando

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

Please start your own thread.


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