I'm trying to reference a groovy script file that I created, and getting unable to find (see below). I didn't have a config directory, and elasticsearch.yml is in etc/elasticsearch. I added config/scripts/ under usr/share/elasticsearch so I now have /usr/share/elasticsearch/config/scripts/.
In there, I placed my script- 'source_types.groovy', which I ran chown elasticsearch:elasticsearch on to ensure the user called elasticsearch owns it.
I also put a config/scripts/source_types.groovy in etc/elasticsearch.
I am trying to call the script as follows:
GET nr-01/_search
{
"query": {
"filtered": {
"filter": {
"script": {
"file": "source_types.groovy",
"lang": "groovy"
}
}
}
}
}
and I'm getting
nested: SearchParseException[[nr-01][4]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\n \"query\": {\n \"filtered\": {\n \"filter\": {\n \"script\": {\n \"file\": \"source_types.groovy\",\n \"lang\": \"groovy\"\n }\n }\n }\n }\n}\n]]]; nested: ElasticsearchIllegalArgumentException[Unable to find on disk script source_types.groovy]; }]",
"status": 400
Obviously the file can't be found. Where does the script go? Am I calling it correctly?
"file": "source_types", do you see any difference?/etc/elasticsearch/scriptsfolder (meaning omittingconfig).