Re-index all the indices in elasticsearch

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?

There is no simple method that I know. Since the type is stored with each document, the Reindex API 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 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 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!

1 Like

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