# How to schedule the execution of an update\_by\_query painless script in a cluster

**URL:** <https://discuss.elastic.co/t/how-to-schedule-the-execution-of-an-update-by-query-painless-script-in-a-cluster/294089>\
**Category:** Elasticsearch\
**Tags:** painless\
**Created:** [January 11, 2022, 10:56pm UTC](https://discuss.elastic.co/t/how-to-schedule-the-execution-of-an-update-by-query-painless-script-in-a-cluster/294089 "2022-01-11T22:56:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rui\_Goncalves](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rui_goncalves/32/72197_2.png) [@Rui\_Goncalves](https://discuss.elastic.co/u/Rui_Goncalves)\
**Post date:** [January 11, 2022, 10:56pm UTC](https://discuss.elastic.co/t/how-to-schedule-the-execution-of-an-update-by-query-painless-script-in-a-cluster/294089/1 "2022-01-11T22:56:18Z")

</div>

I need to schedule the execution of an update\_by\_query painless script so that it gets executed in the current Primary shard of the cluster regardless of the nodes of the script that might me down. I think that Kibana console does this behind the scenes but how can I dot it in an automatic way?

---

<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:** [January 11, 2022, 10:58pm UTC](https://discuss.elastic.co/t/how-to-schedule-the-execution-of-an-update-by-query-painless-script-in-a-cluster/294089/2 "2022-01-11T22:58:33Z")

</div>

There's currently nothing in Elasticsearch to do this sorry to say. You'd need to manage it externally.

---

<div class="post-metadata">

**Author:** ![Rui\_Goncalves](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rui_goncalves/32/72197_2.png) [@Rui\_Goncalves](https://discuss.elastic.co/u/Rui_Goncalves)\
**Post date:** [January 12, 2022, 8:23am UTC](https://discuss.elastic.co/t/how-to-schedule-the-execution-of-an-update-by-query-painless-script-in-a-cluster/294089/3 "2022-01-12T08:23:31Z")

</div>

Thank you Mark

---

<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:** [February 9, 2022, 8:23am UTC](https://discuss.elastic.co/t/how-to-schedule-the-execution-of-an-update-by-query-painless-script-in-a-cluster/294089/4 "2022-02-09T08:23:54Z")

</div>

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