# Does the new Reindex API always reindex to a single shard?

**URL:** <https://discuss.elastic.co/t/does-the-new-reindex-api-always-reindex-to-a-single-shard/46537>\
**Category:** Elasticsearch\
**Created:** [April 6, 2016, 2:00pm UTC](https://discuss.elastic.co/t/does-the-new-reindex-api-always-reindex-to-a-single-shard/46537 "2016-04-06T14:00:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChrisR](https://avatars.discourse-cdn.com/v4/letter/c/ecd19e/32.png) [@ChrisR](https://discuss.elastic.co/u/ChrisR)\
**Post date:** [April 6, 2016, 2:00pm UTC](https://discuss.elastic.co/t/does-the-new-reindex-api-always-reindex-to-a-single-shard/46537/1 "2016-04-06T14:00:53Z")

</div>

I used the new reindex API recently and noticed it reduced the old index of 5 primary shards to a new index with only 1 primary shard.

Is the idea that we should typically create the new index with n shards first before reindexing to it?

---

<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:** [April 6, 2016, 2:16pm UTC](https://discuss.elastic.co/t/does-the-new-reindex-api-always-reindex-to-a-single-shard/46537/2 "2016-04-06T14:16:24Z")

</div>

It behaves just like a bulk request in that it'll make the index if it doesn't exist using the default settings. Did you add an index template that defaults you to 1 shard?

> [@ChrisR](#):
>
> Is the idea that we should typically create the new index with n shards first before reindexing to it?

Yeah. I didn't want to cram the index creation API inside of reindex when you can just call the index creation API. It seemed like more complexity than was worth it. The real benefit of reindex is that you don't have to manage the scroll context and the looping. It makes "copy one index into another" a thing even **I** can do in a shell script.

---

<div class="post-metadata">

**Author:** ![ChrisR](https://avatars.discourse-cdn.com/v4/letter/c/ecd19e/32.png) [@ChrisR](https://discuss.elastic.co/u/ChrisR)\
**Post date:** [April 6, 2016, 3:00pm UTC](https://discuss.elastic.co/t/does-the-new-reindex-api-always-reindex-to-a-single-shard/46537/3 "2016-04-06T15:00:17Z")

</div>

That makes a lot of sense to have the reindex API just do the reindexing and no more.

I wasn't sure at first why it didn't create the default 5 shards, but now I see that I did apply an index template earlier with only one shard.

Thanks.

---

<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:** [April 6, 2016, 3:14pm UTC](https://discuss.elastic.co/t/does-the-new-reindex-api-always-reindex-to-a-single-shard/46537/4 "2016-04-06T15:14:12Z")

</div>

> [@ChrisR](#):
>
> now I see that I did apply an index template

Awesome! I'm glad it wasn't something really really sneaky. Just normal, somewhat sneaky templates.

I'm glad I could help and sorry for the confusion.

---

<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:01pm UTC](https://discuss.elastic.co/t/does-the-new-reindex-api-always-reindex-to-a-single-shard/46537/5 "2017-07-05T23:01:48Z")

</div>


