# Bash script for reindex

**URL:** <https://discuss.elastic.co/t/bash-script-for-reindex/185849>\
**Category:** Elasticsearch\
**Created:** [June 14, 2019, 12:02pm UTC](https://discuss.elastic.co/t/bash-script-for-reindex/185849 "2019-06-14T12:02:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![test\_qweqwe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/test_qweqwe/32/94750_2.png) [@test\_qweqwe](https://discuss.elastic.co/u/test_qweqwe)\
**Post date:** [June 14, 2019, 12:02pm UTC](https://discuss.elastic.co/t/bash-script-for-reindex/185849/1 "2019-06-14T12:02:35Z")

</div>

Hi  
I never had a deal with scripting and API.  
I have one ELK on-demand instance and for example there are 10 clients and all indices have format aka "logstash-2019.01.01-000001".  
How to build script that will reindex data and I can choose what client data should be reindexed?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [June 17, 2019, 12:28pm UTC](https://discuss.elastic.co/t/bash-script-for-reindex/185849/2 "2019-06-17T12:28:27Z")

</div>

I am not sure I fully got the question, so feel free to expand (for example with a sample dataset), but you could use the [reindex API](https://www.elastic.co/guide/en/elasticsearch/reference/7.1/docs-reindex.html) in combination with a query that filters for your clients data and then specify a different index for each of your clients.

Hope this helps!

---

<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 16, 2019, 9:30am UTC](https://discuss.elastic.co/t/bash-script-for-reindex/185849/4 "2019-07-16T09:30:34Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
