# How to dynamically set script.max\_compilations\_per\_minute?

**URL:** <https://discuss.elastic.co/t/how-to-dynamically-set-script-max-compilations-per-minute/75493>\
**Category:** Elasticsearch\
**Created:** [February 17, 2017, 1:01pm UTC](https://discuss.elastic.co/t/how-to-dynamically-set-script-max-compilations-per-minute/75493 "2017-02-17T13:01:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![patlola](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/patlola/32/14190_2.png) [@patlola](https://discuss.elastic.co/u/patlola)\
**Post date:** [February 17, 2017, 1:01pm UTC](https://discuss.elastic.co/t/how-to-dynamically-set-script-max-compilations-per-minute/75493/1 "2017-02-17T13:01:38Z")

</div>

I know that we can add this config in elasticsearch.yml but i would like to do it dynamically.

documentation says we can change the setting dynamically.  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting-using.html#prefer-params](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting-using.html#prefer-params)

please help me with the curl for updating this setting.

PS : I can't update this in elasticcloud too cause this setting is not supported in there configuration.

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [February 17, 2017, 3:06pm UTC](https://discuss.elastic.co/t/how-to-dynamically-set-script-max-compilations-per-minute/75493/2 "2017-02-17T15:06:19Z")

</div>

Hi @patlola,

just as a hint: you can reduce script compilations by using parameters. Then Elasticsearch needs to compile the script just once and call it many times with different parameters and this is much better for performance.

Having that said, here's what you need to do to change the setting:

```auto
PUT /_cluster/settings
{
    "transient" : {
        "script.max_compilations_per_minute" : 20
    }
}

```

Daniel

---

<div class="post-metadata">

**Author:** ![patlola](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/patlola/32/14190_2.png) [@patlola](https://discuss.elastic.co/u/patlola)\
**Post date:** [February 18, 2017, 3:56am UTC](https://discuss.elastic.co/t/how-to-dynamically-set-script-max-compilations-per-minute/75493/3 "2017-02-18T03:56:59Z")

</div>

Thanks @danielmitterdorfer , i will try this 😃

---

<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:** [March 18, 2017, 3:57am UTC](https://discuss.elastic.co/t/how-to-dynamically-set-script-max-compilations-per-minute/75493/4 "2017-03-18T03:57:41Z")

</div>

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