# Re-index all the indices in elasticsearch

**URL:** <https://discuss.elastic.co/t/re-index-all-the-indices-in-elasticsearch/197660>\
**Category:** Elasticsearch\
**Created:** [September 2, 2019, 9:44am UTC](https://discuss.elastic.co/t/re-index-all-the-indices-in-elasticsearch/197660 "2019-09-02T09:44:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tianji\_Zhao](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tianji_zhao/32/48260_2.png) [@Tianji\_Zhao](https://discuss.elastic.co/u/Tianji_Zhao)\
**Post date:** [September 2, 2019, 9:44am UTC](https://discuss.elastic.co/t/re-index-all-the-indices-in-elasticsearch/197660/1 "2019-09-02T09:44:06Z")

</div>

I have to re-index all the indices in the elastic to change the type of several fields.  
For the reason that it has two many indices, I could not use the re-index API to change them one by one.  
So is there any method that change all the indices simply?

---

<div class="post-metadata">

**Author:** ![Bernt\_Rostad](https://avatars.discourse-cdn.com/v4/letter/b/3ab097/32.png) [@Bernt\_Rostad](https://discuss.elastic.co/u/Bernt_Rostad)\
**Post date:** [September 2, 2019, 11:03am UTC](https://discuss.elastic.co/t/re-index-all-the-indices-in-elasticsearch/197660/2 "2019-09-02T11:03:03Z")

</div>

> [@Tianji\_Zhao](#):
>
> So is there any method that change all the indices simply?

There is no simple method that I know. Since the type is stored with each document, the [Reindex API](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html) really is the best way. Unless you can re-feed all your data from a primary data source to build up a new index structure in an empty cluster.

If your cluster really is too full to create new indices you either have to delete some old indices, or perhaps set [number\_of\_replicas](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html) to 0, to free up space for the new index you want to create. If you need to delete indices and don't have a primary data source you can save a backup of the indices by taking a [snapshot](https://www.elastic.co/guide/en/elasticsearch/reference/7.3/modules-snapshots.html) of them. When the cluster is finally manageable you can then restore the deleted indices from the snapshot and reindex them, one by one, into the new index structure.

Alternatively, if you don't have too much data you could create a temporary cluster which you reindex into from the full cluster, fixing the types and reducing the number of indices as you go along. When done you can delete all indices in the full luster, take a snapshot in the temporary cluster and simply restore that snapshot into the empty cluster.

There could be other ways to solve your full cluster problem, but those would be my alternatives for a solution.

Good luck!

---

<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:** [September 30, 2019, 11:03am UTC](https://discuss.elastic.co/t/re-index-all-the-indices-in-elasticsearch/197660/3 "2019-09-30T11:03:03Z")

</div>

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