# How to copy an index with 5 shards to an index with 1 shard

**URL:** <https://discuss.elastic.co/t/how-to-copy-an-index-with-5-shards-to-an-index-with-1-shard/14724>\
**Category:** Elasticsearch\
**Created:** [December 5, 2013, 11:24am UTC](https://discuss.elastic.co/t/how-to-copy-an-index-with-5-shards-to-an-index-with-1-shard/14724 "2013-12-05T11:24:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ben\_Ryan](https://avatars.discourse-cdn.com/v4/letter/b/dfb087/32.png) [@Ben\_Ryan](https://discuss.elastic.co/u/Ben_Ryan)\
**Post date:** [December 5, 2013, 11:24am UTC](https://discuss.elastic.co/t/how-to-copy-an-index-with-5-shards-to-an-index-with-1-shard/14724/1 "2013-12-05T11:24:37Z")

</div>

Hi,

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/088474b4-ed13-4ef0-b7d0-b7e7d2acbf83%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/088474b4-ed13-4ef0-b7d0-b7e7d2acbf83%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![radu\_gheorghe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/radu_gheorghe/32/556_2.png) [@radu\_gheorghe](https://discuss.elastic.co/u/radu_gheorghe)\
**Post date:** [December 5, 2013, 2:16pm UTC](https://discuss.elastic.co/t/how-to-copy-an-index-with-5-shards-to-an-index-with-1-shard/14724/2 "2013-12-05T14:16:21Z")

</div>

Hi Ben,

You'll have to reindex your data. One way to do it is to scroll through the  
existing index and make a new one with the same data, then delete the  
initial index. Here's a blog post by Zachary with some code that should  
help:  
[http://euphonious-intuition.com/2012/08/reindexing-your-elasticsearch-data-with-scanscroll/](http://euphonious-intuition.com/2012/08/reindexing-your-elasticsearch-data-with-scanscroll/)

Best regards,  
Radu

On Thu, Dec 5, 2013 at 1:24 PM, Ben Ryan [argaric@gmail.com](mailto:argaric@gmail.com) wrote:

> Hi,
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/088474b4-ed13-4ef0-b7d0-b7e7d2acbf83%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/088474b4-ed13-4ef0-b7d0-b7e7d2acbf83%40googlegroups.com)  
> .  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
Performance Monitoring \* Log Analytics \* Search Analytics  
Solr & Elasticsearch Support \* [http://sematext.com/](http://sematext.com/)

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAHXA0\_0q8agN%2B2063F\_DHq9i75\_EtCRq4gdMASfa4JavkQGD%2Bg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHXA0_0q8agN%2B2063F_DHq9i75_EtCRq4gdMASfa4JavkQGD%2Bg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Jason\_Wee](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@Jason\_Wee](https://discuss.elastic.co/u/Jason_Wee)\
**Post date:** [December 5, 2013, 8:35pm UTC](https://discuss.elastic.co/t/how-to-copy-an-index-with-5-shards-to-an-index-with-1-shard/14724/3 "2013-12-05T20:35:39Z")

</div>

Hi Ben,

+1 to Radu answer. If you are familiar to perl, you can also try this

> **[Elasticsearch::Bulk - A helper module for the Bulk API and for reindexing -...](https://metacpan.org/release/DRTECH/Elasticsearch-0.76/view/lib/Elasticsearch/Bulk.pm)**
>
> A helper module for the Bulk API and for reindexing

.  
Did reindex a few days ago.

/Jason

On Thu, Dec 5, 2013 at 10:16 PM, Radu Gheorghe  
[radu.gheorghe@sematext.com](mailto:radu.gheorghe@sematext.com)wrote:

> Hi Ben,
> 
> You'll have to reindex your data. One way to do it is to scroll through  
> the existing index and make a new one with the same data, then delete the  
> initial index. Here's a blog post by Zachary with some code that should  
> help:
> 
> [http://euphonious-intuition.com/2012/08/reindexing-your-elasticsearch-data-with-scanscroll/](http://euphonious-intuition.com/2012/08/reindexing-your-elasticsearch-data-with-scanscroll/)
> 
> Best regards,  
> Radu
> 
> On Thu, Dec 5, 2013 at 1:24 PM, Ben Ryan [argaric@gmail.com](mailto:argaric@gmail.com) wrote:
> 
> > Hi,
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/088474b4-ed13-4ef0-b7d0-b7e7d2acbf83%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/088474b4-ed13-4ef0-b7d0-b7e7d2acbf83%40googlegroups.com)  
> > .  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> Performance Monitoring \* Log Analytics \* Search Analytics  
> Solr & Elasticsearch Support \* [http://sematext.com/](http://sematext.com/)
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAHXA0\_0q8agN%2B2063F\_DHq9i75\_EtCRq4gdMASfa4JavkQGD%2Bg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHXA0_0q8agN%2B2063F_DHq9i75_EtCRq4gdMASfa4JavkQGD%2Bg%40mail.gmail.com)  
> .
> 
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAHO4itzVr8LDGYEzN%2BUGHcnFHQ-CUwVP0v\_pWaNNeZEgqTGjsg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHO4itzVr8LDGYEzN%2BUGHcnFHQ-CUwVP0v_pWaNNeZEgqTGjsg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [December 5, 2013, 8:57pm UTC](https://discuss.elastic.co/t/how-to-copy-an-index-with-5-shards-to-an-index-with-1-shard/14724/4 "2013-12-05T20:57:33Z")

</div>

This is also really useful - [GitHub - elastic/stream2es: Stream data into ES (Wikipedia, Twitter, stdin, or other ESes)](https://github.com/elasticsearch/stream2es)

Regards,  
Mark Walkom

Infrastructure Engineer  
Campaign Monitor  
email: [markw@campaignmonitor.com](mailto:markw@campaignmonitor.com)  
web: [www.campaignmonitor.com](http://www.campaignmonitor.com)

On 6 December 2013 07:35, Jason Wee [peichieh@gmail.com](mailto:peichieh@gmail.com) wrote:

> Hi Ben,
> 
> +1 to Radu answer. If you are familiar to perl, you can also try this  
> [http://search.cpan.org/~drtech/Elasticsearch-0.76/lib/Elasticsearch/Bulk.pm#reindex()](http://search.cpan.org/~drtech/Elasticsearch-0.76/lib/Elasticsearch/Bulk.pm#reindex()) .  
> Did reindex a few days ago.
> 
> /Jason
> 
> On Thu, Dec 5, 2013 at 10:16 PM, Radu Gheorghe \<[radu.gheorghe@sematext.com](mailto:radu.gheorghe@sematext.com)
> 
> > wrote:
> 
> > Hi Ben,
> > 
> > You'll have to reindex your data. One way to do it is to scroll through  
> > the existing index and make a new one with the same data, then delete the  
> > initial index. Here's a blog post by Zachary with some code that should  
> > help:
> > 
> > [http://euphonious-intuition.com/2012/08/reindexing-your-elasticsearch-data-with-scanscroll/](http://euphonious-intuition.com/2012/08/reindexing-your-elasticsearch-data-with-scanscroll/)
> > 
> > Best regards,  
> > Radu
> > 
> > On Thu, Dec 5, 2013 at 1:24 PM, Ben Ryan [argaric@gmail.com](mailto:argaric@gmail.com) wrote:
> > 
> > > Hi,
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/088474b4-ed13-4ef0-b7d0-b7e7d2acbf83%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/088474b4-ed13-4ef0-b7d0-b7e7d2acbf83%40googlegroups.com)  
> > > .  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > 
> > --  
> > Performance Monitoring \* Log Analytics \* Search Analytics  
> > Solr & Elasticsearch Support \* [http://sematext.com/](http://sematext.com/)
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CAHXA0\_0q8agN%2B2063F\_DHq9i75\_EtCRq4gdMASfa4JavkQGD%2Bg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHXA0_0q8agN%2B2063F_DHq9i75_EtCRq4gdMASfa4JavkQGD%2Bg%40mail.gmail.com)  
> > .
> > 
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAHO4itzVr8LDGYEzN%2BUGHcnFHQ-CUwVP0v\_pWaNNeZEgqTGjsg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHO4itzVr8LDGYEzN%2BUGHcnFHQ-CUwVP0v_pWaNNeZEgqTGjsg%40mail.gmail.com)  
> .
> 
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAEM624boB1t0J10sn%3D7XBTHitnnfg7Cj9cX1Z6O4zZvePoK5gg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAEM624boB1t0J10sn%3D7XBTHitnnfg7Cj9cX1Z6O4zZvePoK5gg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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 6, 2017, 2:02am UTC](https://discuss.elastic.co/t/how-to-copy-an-index-with-5-shards-to-an-index-with-1-shard/14724/5 "2017-07-06T02:02:59Z")

</div>


