# Problem with Number of Shards (8 to 5)

**URL:** <https://discuss.elastic.co/t/problem-with-number-of-shards-8-to-5/50003>\
**Category:** Elasticsearch\
**Created:** [May 13, 2016, 2:16pm UTC](https://discuss.elastic.co/t/problem-with-number-of-shards-8-to-5/50003 "2016-05-13T14:16:39Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![parthu](https://avatars.discourse-cdn.com/v4/letter/p/e5b9ba/32.png) [@parthu](https://discuss.elastic.co/u/parthu)\
**Post date:** [May 13, 2016, 2:16pm UTC](https://discuss.elastic.co/t/problem-with-number-of-shards-8-to-5/50003/1 "2016-05-13T14:16:39Z")

</div>

I upgraded my elasticsearch 1.3.2 to elasticsearch 2.3.2. All was well, but due to certain reasons I had to downgrade it back to 1.3.2. Now, I get to see only 5 shards per index. It used to be 8 shards per index.

I have no idea how this has happened. Can anyone tell me how to go back to having 8 shards per index?

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [May 13, 2016, 2:29pm UTC](https://discuss.elastic.co/t/problem-with-number-of-shards-8-to-5/50003/2 "2016-05-13T14:29:05Z")

</div>

> [@parthu](#):
>
> downgrade it back to 1.3.2.

Data isn't really backwards compatible. But If you hadn't written anything it might be ok.

> [@parthu](#):
>
> Can anyone tell me how to go back to having 8 shards per index?

That is a thing that you can get either from elasticsearch.yaml or by setting up a template.

---

<div class="post-metadata">

**Author:** ![parthu](https://avatars.discourse-cdn.com/v4/letter/p/e5b9ba/32.png) [@parthu](https://discuss.elastic.co/u/parthu)\
**Post date:** [May 13, 2016, 2:42pm UTC](https://discuss.elastic.co/t/problem-with-number-of-shards-8-to-5/50003/3 "2016-05-13T14:42:33Z")

</div>

I did try updating the elasticsearch.yml file with 8 (for the number of shards) and tried restarting everything. But it doesn't give me back my 8 shards. It just shows 5.

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [May 13, 2016, 3:12pm UTC](https://discuss.elastic.co/t/problem-with-number-of-shards-8-to-5/50003/4 "2016-05-13T15:12:17Z")

</div>

> [@parthu](#):
>
> But it doesn't give me back my 8 shards. It just shows 5.

That setting is a default for newly created indexes. When you create a new index does it come with the 8?

---

<div class="post-metadata">

**Author:** ![parthu](https://avatars.discourse-cdn.com/v4/letter/p/e5b9ba/32.png) [@parthu](https://discuss.elastic.co/u/parthu)\
**Post date:** [May 13, 2016, 3:14pm UTC](https://discuss.elastic.co/t/problem-with-number-of-shards-8-to-5/50003/5 "2016-05-13T15:14:58Z")

</div>

We just have one index in this cluster. The number of shards has always been 8. (Now, I wonder how they set it up so it could produce 8 shards. I see this set nowhere. Not even in the elasticsearch.yml file. Not even in bin/setenv.) After the upgrade-downgrade exercise I've done, the number of shards has dipped to 5. I've tried various things, like setting it up in the .yml file, using a template as you suggested. Nothing works!

I just need some direction as to how to go back to having 8 shards.

---

<div class="post-metadata">

**Author:** ![parthu](https://avatars.discourse-cdn.com/v4/letter/p/e5b9ba/32.png) [@parthu](https://discuss.elastic.co/u/parthu)\
**Post date:** [May 13, 2016, 3:21pm UTC](https://discuss.elastic.co/t/problem-with-number-of-shards-8-to-5/50003/6 "2016-05-13T15:21:13Z")

</div>

I have used a template like this. Can you tell me if it's the right way?

curl -XPUT local:9200/\_template/template\_1 -d ' {  
"template" : "me\*"  
"settings": {  
"number\_of\_shards": 8  
}  
}'

Should I add anything else?

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [May 13, 2016, 3:28pm UTC](https://discuss.elastic.co/t/problem-with-number-of-shards-8-to-5/50003/7 "2016-05-13T15:28:37Z")

</div>

> [@parthu](#):
>
> Should I add anything else?

Something like that will work, sure. You'll have to recreate the index if you want to change the number of shards it has. That is a thing that is set at creation. You can use the reindex command to copy everything from the old index into the new index if you'd like.

---

<div class="post-metadata">

**Author:** ![parthu](https://avatars.discourse-cdn.com/v4/letter/p/e5b9ba/32.png) [@parthu](https://discuss.elastic.co/u/parthu)\
**Post date:** [May 13, 2016, 7:25pm UTC](https://discuss.elastic.co/t/problem-with-number-of-shards-8-to-5/50003/8 "2016-05-13T19:25:46Z")

</div>

Can you tell me how to reindex? I've read the documentation here: [https://www.elastic.co/guide/en/elasticsearch/guide/1.x/reindex.html](https://www.elastic.co/guide/en/elasticsearch/guide/1.x/reindex.html)

What I haven't been able to understand is this: "To reindex all of the documents from the old index efficiently, use scan-and-scroll to retrieve batches of documents from the old index, and the bulk API to push them into the new index."

I did get the scroll ID. But how do I use it to insert documents into my new index using a curl command(in the bulk API to be specific)? I haven't found any examples of this. Can you help?

---

<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, 10:51pm UTC](https://discuss.elastic.co/t/problem-with-number-of-shards-8-to-5/50003/9 "2017-07-05T22:51:31Z")

</div>


