# Scripted field and "Too many dynamic script compilations within one minute,"

**URL:** <https://discuss.elastic.co/t/scripted-field-and-too-many-dynamic-script-compilations-within-one-minute/101671>\
**Category:** Kibana\
**Created:** [September 25, 2017, 9:37am UTC](https://discuss.elastic.co/t/scripted-field-and-too-many-dynamic-script-compilations-within-one-minute/101671 "2017-09-25T09:37:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![amichaim](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@amichaim](https://discuss.elastic.co/u/amichaim)\
**Post date:** [September 25, 2017, 9:37am UTC](https://discuss.elastic.co/t/scripted-field-and-too-many-dynamic-script-compilations-within-one-minute/101671/1 "2017-09-25T09:37:27Z")

</div>

Hi

I'm using elastic/kibana 5.5.1  
My scripted field get the "Too many dynamic script compilations within one minute" error.  
Now I saw the recommendation to use indexed scripts, file based scripts or to use parameters in the script.  
Is any of these options can be done in Kibana?  
Another solution I saw is to change the settings of "script.max\_compilations\_per\_minute", but I couldn't do that.  
I tried:  
PUT /\_cluster/settings  
{  
"transient" : {  
"script.max\_compilations\_per\_minute" : 20  
}  
}  
but this wasn't work: "Validation Failed: 1: no settings to update;"

Any help?

---

<div class="post-metadata">

**Author:** ![Joe\_Fleming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_fleming/32/3561_2.png) [@Joe\_Fleming](https://discuss.elastic.co/u/Joe_Fleming)\
**Post date:** [September 25, 2017, 7:31pm UTC](https://discuss.elastic.co/t/scripted-field-and-too-many-dynamic-script-compilations-within-one-minute/101671/2 "2017-09-25T19:31:20Z")

</div>

It looks like there's a [change to that check](https://github.com/elastic/elasticsearch/pull/26399) that will be landing in 6.0, which doesn't really help you now, but just so you know.

As for the setting, I tried running this in Kibana's Console, and it worked for me. Are you sure you don't have something else enabled that might stop you from setting it (like Security)?

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

```

Otherwise, it looks like Kibana only supports inline scripts, so indexed and file based scripts are out. And as far as I can tell, there's no way to use parameters with inline scripts in Kibana either.

---

<div class="post-metadata">

**Author:** ![amichaim](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@amichaim](https://discuss.elastic.co/u/amichaim)\
**Post date:** [October 2, 2017, 11:30am UTC](https://discuss.elastic.co/t/scripted-field-and-too-many-dynamic-script-compilations-within-one-minute/101671/3 "2017-10-02T11:30:24Z")

</div>

I'm writing here the root cause of the problem so it could help someone.  
The problem was due to path without return in the scripted field. Means some "if" "else if" "else if" without last "else".  
I could noticed that only after increasing the script.max\_compilations\_per\_minute over to 1000, and then instead of "Too many dynamic script compilations within one minute,” I got the real error.

---

<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:** [October 30, 2017, 11:30am UTC](https://discuss.elastic.co/t/scripted-field-and-too-many-dynamic-script-compilations-within-one-minute/101671/4 "2017-10-30T11:30:44Z")

</div>

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