# Groovy script throwing script compilation error

**URL:** <https://discuss.elastic.co/t/groovy-script-throwing-script-compilation-error/43156>\
**Category:** Elasticsearch\
**Created:** [March 1, 2016, 8:12pm UTC](https://discuss.elastic.co/t/groovy-script-throwing-script-compilation-error/43156 "2016-03-01T20:12:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrew\_kh](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@andrew\_kh](https://discuss.elastic.co/u/andrew_kh)\
**Post date:** [March 1, 2016, 8:12pm UTC](https://discuss.elastic.co/t/groovy-script-throwing-script-compilation-error/43156/1 "2016-03-01T20:12:21Z")

</div>

I have a groovy script I'm trying to use to update the value of a property on a document. I took my old inline script and moved it into a script file in config/scripts called tag\_updater.groovy. It contains:

```
ctx._source.tags = tags

```

It seems to compile fine generating: compiling script file [/usr/local/elasticsearch-1.4.4/config/scripts/tag\_videos.groovy] in my log.

But whenever I try to actually run the script I get:

'ElasticsearchIllegalArgumentException[failed to execute script]; nested: GroovyScriptCompilationException[MultipleCompilationErrorsException[startup failed:\nScript13.groovy: 1: Ambiguous expression could be either a parameterless closure expression or an isolated open code block;\n solution: Add an explicit closure parameter list, e.g. {it -\> ...}, or force it to be treated as an open block by giving it a label, e.g. L:{...} @ line 1, column 1.\n {\n ^\n\n1 error\n]];

This is my update script:

'{  
"script" : {  
"file" : "tag\_videos",  
"lang" : "groovy",  
"params": {  
"tags": "'.$this-\>request-\>data['tags'].'"  
}  
}  
}'

Edit: It seems I had script.disable\_dynamic set to false. When I set it to true, I get:

'ElasticsearchIllegalArgumentException[failed to execute script]; nested: ScriptException[dynamic scripting for [groovy] disabled];

Even though I am not trying to use dynamic scripting. According to docs setting disable\_dynamic to false should still allow you to use scripts stored in the config/scripts folder.

---

<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:** [July 5, 2017, 11:12pm UTC](https://discuss.elastic.co/t/groovy-script-throwing-script-compilation-error/43156/2 "2017-07-05T23:12:16Z")

</div>


