# Shards not assigned when creating an index

**URL:** https://discuss.elastic.co/t/shards-not-assigned-when-creating-an-index/31274
**Category:** Elasticsearch
**Created:** [September 28, 2015, 4:33pm UTC](https://discuss.elastic.co/t/shards-not-assigned-when-creating-an-index/31274 "2015-09-28T16:33:39Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Pablo](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@Pablo](https://discuss.elastic.co/u/Pablo)
#### Post date: [September 28, 2015, 4:33pm UTC](https://discuss.elastic.co/t/shards-not-assigned-when-creating-an-index/31274/1 "2015-09-28T16:33:39Z")

</div>

Hi all.

I am having trouble creating a new index: elastic search assigns 3 shards and leaves 2 unassigned.

It is installed as a 4-node cluster in amazon, almost out of the box. The cluster has 2 nodes in 2 different availability zones. It is configured with 5 shards and 3 replicas. I create the index from a java client and start indexing documents immediately. In kopf, the cluster appears red, with 2 master shards unassigned. The last 2 times I tried, it successfully created shards 1, 2 and 3, but failed in shards 0 and 4. We had to manually assign the shards to a node.

I enabled the debug logs, but no exception there. It looks like the index is created, closed and reopened. In the logs I found:

state: [RECOVERING]-\>[CLOSED], reason [removing shard (index is closed)]

for the failing shards, and:

state: [STARTED]-\>[CLOSED], reason [removing shard (index is closed)]

for the working shards.

Any ideas?

Thanks a lot.

---

<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 28, 2015, 4:36pm UTC](https://discuss.elastic.co/t/shards-not-assigned-when-creating-an-index/31274/2 "2015-09-28T16:36:16Z")

</div>

Lack of disk space if usually the primary reason for this.

---

<div class="post-metadata">

### Author: ![Pablo](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@Pablo](https://discuss.elastic.co/u/Pablo)
#### Post date: [September 28, 2015, 6:17pm UTC](https://discuss.elastic.co/t/shards-not-assigned-when-creating-an-index/31274/3 "2015-09-28T18:17:59Z")

</div>

Thanks for your answer.

I checked that the first time it failed, but all nodes had plenty of space.

---

<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:47pm UTC](https://discuss.elastic.co/t/shards-not-assigned-when-creating-an-index/31274/4 "2017-07-05T23:47:40Z")

</div>


