# How to solve unavailable\_shards\_exception?

**URL:** <https://discuss.elastic.co/t/how-to-solve-unavailable-shards-exception/92967>\
**Category:** Elasticsearch\
**Created:** [July 13, 2017, 8:58am UTC](https://discuss.elastic.co/t/how-to-solve-unavailable-shards-exception/92967 "2017-07-13T08:58:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![LmYjQ](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lmyjq/32/97480_2.png) [@LmYjQ](https://discuss.elastic.co/u/LmYjQ)\
**Post date:** [July 13, 2017, 8:58am UTC](https://discuss.elastic.co/t/how-to-solve-unavailable-shards-exception/92967/1 "2017-07-13T08:58:44Z")

</div>

I have encountered the following exception

```
[2017-07-13T16:51:02,186][INFO][logstash.outputs.elasticsearch] retrying failed action with response code: 503 ({"type"=>"unavailable_shards_exception", "reason"=>"[logstash-im_message-2017.07.13][2] primary shard is not active Timeout: [1m], request: [BulkShardRequest [[logstash-im_message-2017.07.13][2]] containing [4] requests]"})
[2017-07-13T16:51:02,186][ERROR][logstash.outputs.elasticsearch] Retrying individual actions
[2017-07-13T16:51:02,186][ERROR][logstash.outputs.elasticsearch] Action
[2017-07-13T16:51:02,186][ERROR][logstash.outputs.elasticsearch] Action
[2017-07-13T16:51:02,186][ERROR][logstash.outputs.elasticsearch] Action
[2017-07-13T16:51:02,186][ERROR][logstash.outputs.elasticsearch] Action

```

There is an unassigned shard, I have no idea if this is the cause,

```
{
  "index": "logstash-im_message-2017.07.13",
  "shard": 2,
  "primary": false,
  "current_state": "unassigned",
  "unassigned_info": {
    "reason": "INDEX_CREATED",
    "at": "2017-07-13T00:05:03.861Z",
    "last_allocation_status": "no_attempt"
  },
  "can_allocate": "no",
  "allocate_explanation": "cannot allocate because allocation is not permitted to any of the nodes",
  "node_allocation_decisions": [
    {
      "node_id": "bts3Wo5eQ62lmhBLUH022g",
      "node_name": "spiderman",
      "transport_address": "192.168.0.213:9300",
      "node_decision": "no",
      "weight_ranking": 1,
      "deciders": [
        {
          "decider": "replica_after_primary_active",
          "decision": "NO",
          "explanation": "primary shard for this replica is not yet active"
        },
        {
          "decider": "throttling",
          "decision": "NO",
          "explanation": "primary shard for this replica is not yet active"
        }
      ]
    },
    {
      "node_id": "75Uk20LHSSC4aV6lD0nlBQ",
      "node_name": "thor",
      "transport_address": "192.168.0.214:9300",
      "node_decision": "no",
      "weight_ranking": 2,
      "deciders": [
        {
          "decider": "replica_after_primary_active",
          "decision": "NO",
          "explanation": "primary shard for this replica is not yet active"
        },
        {
          "decider": "throttling",
          "decision": "NO",
          "explanation": "primary shard for this replica is not yet active"
        }
      ]
    },
    {
      "node_id": "bE78po56TuatkgI-Ijq29w",
      "node_name": "hulk",
      "transport_address": "192.168.0.215:9300",
      "node_decision": "no",
      "weight_ranking": 3,
      "deciders": [
        {
          "decider": "replica_after_primary_active",
          "decision": "NO",
          "explanation": "primary shard for this replica is not yet active"
        },
        {
          "decider": "throttling",
          "decision": "NO",
          "explanation": "primary shard for this replica is not yet active"
        }
      ]
    }
  ]
}
```

---

<div class="post-metadata">

**Author:** ![Xuzheng\_Lin](https://avatars.discourse-cdn.com/v4/letter/x/eb9ed0/32.png) [@Xuzheng\_Lin](https://discuss.elastic.co/u/Xuzheng_Lin)\
**Post date:** [July 14, 2017, 6:14am UTC](https://discuss.elastic.co/t/how-to-solve-unavailable-shards-exception/92967/2 "2017-07-14T06:14:45Z")

</div>

Having same problem here (Version 5.1.1 for Logstash and Elasticsearch). The services are up with same error in Logstash log:  
[logstash.outputs.elasticsearch] retrying failed action with response code: 503 ({"type"=\>"unavailable\_shards\_exception", "reason"=\>"[filebeat-2017.07.14][0] primary shard is not active Timeout: [1m], request: [BulkShardRequest to [filebeat-2017.07.14] containing [44] requests]"})  
And everything looks fine in Elasticsearch log though.  
Looking forward to solution.

---

<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:** [August 11, 2017, 6:14am UTC](https://discuss.elastic.co/t/how-to-solve-unavailable-shards-exception/92967/3 "2017-08-11T06:14:46Z")

</div>

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