# Script\_file in symlinked subdirectory of config/scripts not executing

**URL:** <https://discuss.elastic.co/t/script-file-in-symlinked-subdirectory-of-config-scripts-not-executing/26016>\
**Category:** Elasticsearch\
**Created:** [July 21, 2015, 7:17pm UTC](https://discuss.elastic.co/t/script-file-in-symlinked-subdirectory-of-config-scripts-not-executing/26016 "2015-07-21T19:17:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![twigbranch](https://avatars.discourse-cdn.com/v4/letter/t/2bfe46/32.png) [@twigbranch](https://discuss.elastic.co/u/twigbranch)\
**Post date:** [July 21, 2015, 7:17pm UTC](https://discuss.elastic.co/t/script-file-in-symlinked-subdirectory-of-config-scripts-not-executing/26016/1 "2015-07-21T19:17:54Z")

</div>

Continuing the discussion from [Deploying script files to disk across all nodes](https://discuss.elastic.co/t/deploying-script-files-to-disk-across-all-nodes/725):

I'm trying to deploy scripts into the config/scripts directory by setting a symlink to a newly deployed release. This effectively puts the scripts into a subdirectory of config/scripts, i.e. config/scripts/myapp/myscript

I notice from looking at elasticsearch .log that the script is found and compiled, but when I try to execute the script in an indexing/update operation I get "ElasticsearchIllegalArgumentException[Unable to find on disk script ..."

What's the issue? Are we not allowed to put scripts in subdirectories, or link them via symlink (even though it appears to find and compile them)? Do I have to add some sort of prefix to the script\_file name?

---

<div class="post-metadata">

**Author:** ![twigbranch](https://avatars.discourse-cdn.com/v4/letter/t/2bfe46/32.png) [@twigbranch](https://discuss.elastic.co/u/twigbranch)\
**Post date:** [July 21, 2015, 7:19pm UTC](https://discuss.elastic.co/t/script-file-in-symlinked-subdirectory-of-config-scripts-not-executing/26016/2 "2015-07-21T19:19:40Z")

</div>

Note: issue filed here: [https://github.com/elastic/elasticsearch/issues/12353](https://github.com/elastic/elasticsearch/issues/12353)

---

<div class="post-metadata">

**Author:** ![colings86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colings86/32/44960_2.png) [@colings86](https://discuss.elastic.co/u/colings86)\
**Post date:** [July 22, 2015, 7:16am UTC](https://discuss.elastic.co/t/script-file-in-symlinked-subdirectory-of-config-scripts-not-executing/26016/3 "2015-07-22T07:16:52Z")

</div>

I've have not tried loading file scripts from a symlinked directory before, but it looks like its accessible as you mentioned that your are seeing the compile script message in the logs. Could you paste the whole response here as well as the request?

---

<div class="post-metadata">

**Author:** ![twigbranch](https://avatars.discourse-cdn.com/v4/letter/t/2bfe46/32.png) [@twigbranch](https://discuss.elastic.co/u/twigbranch)\
**Post date:** [July 22, 2015, 7:02pm UTC](https://discuss.elastic.co/t/script-file-in-symlinked-subdirectory-of-config-scripts-not-executing/26016/4 "2015-07-22T19:02:25Z")

</div>

/myapp/release\_path/config/elasticsearch/scripts/ includes:  
myscript\_name.groovy

ln -nfs /myapp/release\_path/config/elasticsearch/scripts /etc/elasticsearch/scripts/myapp

Elasticsearch.log:  
compiling script file [/etc/elasticsearch/scripts/myapp/myscript\_name.groovy]

Request:  
curl -XPOST 'localhost:9200/test/type1/1/\_update' -d '{  
"script" : {  
"lang": "groovy",  
"script\_file": "myscript\_name",  
"params": {  
operation: false,  
new\_doc: true  
}  
}  
}'

Response:  
Elasticsearch::Transport::Transport::Errors::BadRequest: [400] {"error":"ElasticsearchIllegalArgumentException[failed to execute script]; nested: ElasticsearchIllegalArgumentException[Unable to find on disk script myscript\_name]; ","status":400}

---

<div class="post-metadata">

**Author:** ![colings86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colings86/32/44960_2.png) [@colings86](https://discuss.elastic.co/u/colings86)\
**Post date:** [July 22, 2015, 9:38pm UTC](https://discuss.elastic.co/t/script-file-in-symlinked-subdirectory-of-config-scripts-not-executing/26016/5 "2015-07-22T21:38:14Z")

</div>

Have a look at the documentation [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html?q=scripting#modules-scripting) (at the end of the first section just before the "Indexed Scripts" section, but if your script is in `scripts/myapp/myscript_name.groovy` then you will need to reference your script as `myapp_myscript_name`.

```
The name of the script is derived from the hierarchy of directories it exists under, 
and the file name without the lang extension. For example, a script placed under 
config/scripts/group1/group2/test.py will be named group1_group2_test.

```

---

<div class="post-metadata">

**Author:** ![twigbranch](https://avatars.discourse-cdn.com/v4/letter/t/2bfe46/32.png) [@twigbranch](https://discuss.elastic.co/u/twigbranch)\
**Post date:** [July 23, 2015, 12:30am UTC](https://discuss.elastic.co/t/script-file-in-symlinked-subdirectory-of-config-scripts-not-executing/26016/6 "2015-07-23T00:30:19Z")

</div>

That's it. Sorry about that, I looked at that document page several times, but somehow overlooked that paragraph.

---

<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:59pm UTC](https://discuss.elastic.co/t/script-file-in-symlinked-subdirectory-of-config-scripts-not-executing/26016/7 "2017-07-05T23:59:48Z")

</div>


