# Execute script while in maintenance mode

**URL:** <https://discuss.elastic.co/t/execute-script-while-in-maintenance-mode/279050>\
**Category:** Elasticsearch\
**Created:** [July 19, 2021, 11:19am UTC](https://discuss.elastic.co/t/execute-script-while-in-maintenance-mode/279050 "2021-07-19T11:19:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![crl](https://avatars.discourse-cdn.com/v4/letter/c/59ef9b/32.png) [@crl](https://discuss.elastic.co/u/crl)\
**Post date:** [July 19, 2021, 11:19am UTC](https://discuss.elastic.co/t/execute-script-while-in-maintenance-mode/279050/1 "2021-07-19T11:19:11Z")

</div>

I have a cluster hosted in AWS that I have had to place in maintenance mode (stop routing requests) as the incoming requests prevent any work on the cluster in its current state.

Some of the issues are caused by mapping explosion, so I have created the necessary fixed mappings and now need to reindex all of the current indices to hopefully get the cluster back in a somewhat stable state.

I would like to be able to execute a python script to handle the reindexing, as it is very tedious, time consuming and error prone to do it manually via the [elastic.co](http://elastic.co) API console. But since the cluster is in maintenance mode I obviously can't get trough to it.

Does anyone know of a solution to my predicament?

PS. there is more to it than just reindexing as some indices also need to be placed under ILM, with the necessary bootstrapping and other forms of clean up.

---

<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:** [August 16, 2021, 11:19am UTC](https://discuss.elastic.co/t/execute-script-while-in-maintenance-mode/279050/2 "2021-08-16T11:19:47Z")

</div>

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