# Too many dynamic script compilations with inline script

**URL:** <https://discuss.elastic.co/t/too-many-dynamic-script-compilations-with-inline-script/153597>\
**Category:** Logstash\
**Created:** [October 23, 2018, 12:28pm UTC](https://discuss.elastic.co/t/too-many-dynamic-script-compilations-with-inline-script/153597 "2018-10-23T12:28:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthew\_Field](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matthew_field/32/26599_2.png) [@Matthew\_Field](https://discuss.elastic.co/u/Matthew_Field)\
**Post date:** [October 23, 2018, 12:28pm UTC](https://discuss.elastic.co/t/too-many-dynamic-script-compilations-with-inline-script/153597/1 "2018-10-23T12:28:30Z")

</div>

I am using an inline script with logstash.  
However i am getting "too many dynamic script compilations" error.

I understand that this should not happen with an inline script, but it seems to be happening even if i simplify my script as shown.

My logstash config:

```auto
output {
  elasticsearch {
      hosts => ["${ES_CLUSTER}"]
      
      #hosts => ["127.0.0.1"]
      index => "products"
      #user => "${ES_USERNAME}"
      #password => "${ES_PASSWORD}"
      action => "update"
      doc_as_upsert=> "true"
      #there must be a script called "tagger" on elasticsearch
      script => "tagger"
      #for indexed scripts must be left blank, lang is specified in the index, not here
      script_lang => ""
	  script_type => "indexed"
      document_id => "%{sku}"
      
  }
}

```

And my script:

```auto
POST _scripts/tagger
{
  "script": {
    "lang": "painless",
    "source": "ctx._source.my_field = params.event.get('my_field');"
  }
}

```

I am running on docker (docker config below, just in case)

```auto
elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:6.4.0
    container_name: elasticsearch
    environment:
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata1:/usr/share/docker/data-es
    ports:
      - 9200:9200

```

Thanks in advance for any help.

---

<div class="post-metadata">

**Author:** ![Matthew\_Field](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matthew_field/32/26599_2.png) [@Matthew\_Field](https://discuss.elastic.co/u/Matthew_Field)\
**Post date:** [October 24, 2018, 10:08am UTC](https://discuss.elastic.co/t/too-many-dynamic-script-compilations-with-inline-script/153597/2 "2018-10-24T10:08:30Z")

</div>

I found out myself why this was failing. There were 2 reasons . First was a syntax error in the script...silly me for not testing, and secondly, i had not taken into account that the script is stored on cluster, and not on disc. During development on docker, i was restarting the whole stack and so my script was no longer available to be used by logstash.

---

<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:** [November 21, 2018, 10:08am UTC](https://discuss.elastic.co/t/too-many-dynamic-script-compilations-with-inline-script/153597/3 "2018-11-21T10:08:30Z")

</div>

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