# ElasticSearch partial re-index with Logstash

**URL:** <https://discuss.elastic.co/t/elasticsearch-partial-re-index-with-logstash/50085>\
**Category:** Logstash\
**Created:** [May 15, 2016, 7:43pm UTC](https://discuss.elastic.co/t/elasticsearch-partial-re-index-with-logstash/50085 "2016-05-15T19:43:46Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jetnet](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@jetnet](https://discuss.elastic.co/u/jetnet)\
**Post date:** [May 15, 2016, 7:43pm UTC](https://discuss.elastic.co/t/elasticsearch-partial-re-index-with-logstash/50085/1 "2016-05-15T19:43:46Z")

</div>

Hi All!

I'm trying to re-index data from one ES cluster to another with { "match\_all": {} } query, but I'd like to limit the result set by a certain number. Currently, all "total" hits are being fetched from the source ES cluster.  
Is there a way to stop the input when reaching a certain number of documents?  
The "size" parameter of the ES input plugin is applicable for the scrolling only.

Thank you!

---

<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:** [May 16, 2016, 6:41am UTC](https://discuss.elastic.co/t/elasticsearch-partial-re-index-with-logstash/50085/2 "2016-05-16T06:41:14Z")

</div>

There is not.

---

<div class="post-metadata">

**Author:** ![jetnet](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@jetnet](https://discuss.elastic.co/u/jetnet)\
**Post date:** [May 16, 2016, 9:31am UTC](https://discuss.elastic.co/t/elasticsearch-partial-re-index-with-logstash/50085/3 "2016-05-16T09:31:26Z")

</div>

Thank you for the fast reply!  
Do you think it'd make sense to implement a new config parameter (e.g. "count") to achieve that? Thanks!

---

<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:** [May 16, 2016, 5:04pm UTC](https://discuss.elastic.co/t/elasticsearch-partial-re-index-with-logstash/50085/4 "2016-05-16T17:04:09Z")

</div>

Maybe, but what is the use case, why do you only need a certain number of things?

---

<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 16, 2016, 5:16pm UTC](https://discuss.elastic.co/t/elasticsearch-partial-re-index-with-logstash/50085/5 "2016-05-16T17:16:46Z")

</div>

For what it is worth \_reindex in Elasticsearch 2.3+ supports limiting the number of documents copied. I added that because it makes it very convenient to play with smaller data sets.

---

<div class="post-metadata">

**Author:** ![jetnet](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@jetnet](https://discuss.elastic.co/u/jetnet)\
**Post date:** [May 16, 2016, 6:50pm UTC](https://discuss.elastic.co/t/elasticsearch-partial-re-index-with-logstash/50085/6 "2016-05-16T18:50:30Z")

</div>

@warkolm, the use case - to split one big index into chunks, in order to analyse them separately.  
@nik9000, thank you for the hint! You are the genius! 🙂

---

<div class="post-metadata">

**Author:** ![wmikew5672](https://avatars.discourse-cdn.com/v4/letter/w/58956e/32.png) [@wmikew5672](https://discuss.elastic.co/u/wmikew5672)\
**Post date:** [May 18, 2016, 3:33pm UTC](https://discuss.elastic.co/t/elasticsearch-partial-re-index-with-logstash/50085/7 "2016-05-18T15:33:12Z")

</div>

Can you possibly give a small example of implementing \_reindex? It sounds like it's what I need, but I can't find any documentation on the website.

---

<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:** [May 18, 2016, 3:38pm UTC](https://discuss.elastic.co/t/elasticsearch-partial-re-index-with-logstash/50085/8 "2016-05-18T15:38:22Z")

</div>

It's an ES thing - [https://www.elastic.co/guide/en/elasticsearch/reference/2.3/docs-reindex.html](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/docs-reindex.html)

---

<div class="post-metadata">

**Author:** ![wmikew5672](https://avatars.discourse-cdn.com/v4/letter/w/58956e/32.png) [@wmikew5672](https://discuss.elastic.co/u/wmikew5672)\
**Post date:** [May 18, 2016, 3:41pm UTC](https://discuss.elastic.co/t/elasticsearch-partial-re-index-with-logstash/50085/9 "2016-05-18T15:41:08Z")

</div>

Great, thanks for the quick reply, and link!

---

<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, 4:57am UTC](https://discuss.elastic.co/t/elasticsearch-partial-re-index-with-logstash/50085/10 "2017-07-06T04:57:09Z")

</div>


