FS#48321 - [elasticsearch] ./modules/* are missing, causing illegal_argument_exception when groovy scripts runs

Attached to Project: Community Packages
Opened by Anders Ytterström (madrse) - Wednesday, 24 February 2016, 10:37 GMT
Last edited by Massimiliano Torromeo (mtorromeo) - Wednesday, 24 February 2016, 15:08 GMT
Task Type Feature Request
Category Packages
Status Closed
Assigned To Massimiliano Torromeo (mtorromeo)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
The content of ./modules from the original source tarball are not included in the package, causing querys containing scripts written in groovy to throw an illegal_argument_exception, "script_lang not supported [groovy]".

My suggestion is to add the content of this folder to the package. I solved this bug on my own by download the tarball from https://www.elastic.co/downloads/elasticsearch and copy the modules from the tarball to my installation.

Another approach might be to inform about the missing modules and instruct the user to add them manually from the original source tarball, like I did.

I figured it out from this SO thread:
http://stackoverflow.com/questions/35582520/elasticsearch-script-lang-not-supported-groovy

There, this is stated:
> and did you include lang-groovy-2.2.0.jar ? groovy has been removed from the core jar, it's now a module

Additional info:
* package: community/elasticsearch 2.2.0-3



Steps to reproduce:

Install Elasticsearch from community, make sure it runs. Just for the sake of this reproduction, add support for inline scripts in /etc/elasticsearch/config/elasticsearch.yml and restart the elasticsearch service:

script.inline: true

then create a test case using cURL:

$ curl -XPUT "http://localhost:9200/archbugtest/doc/1?refresh" -d'
{
"obj1": {
"test": "something"
},
"obj2": {
"arr2": [ "arr_value1", "arr_value2" ]
}
}'

now, try to run a script on it:

$ curl -XGET "http://localhost:9200/archbugtest/_search" -d'
{
"script_fields": {
"s_obj1": {
"script": "_source.obj1", "lang": "groovy"
},
"s_obj1_test": {
"script": "_source.obj1.test", "lang": "groovy"
},
"s_obj2": {
"script": "_source.obj2", "lang": "groovy"
},
"s_obj2_arr2": {
"script": "_source.obj2.arr2", "lang": "groovy"
}
}
}'

This will cause an illegal_argument_exception, "script_lang not supported [groovy]":

{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"script_lang not supported [groovy]"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"archbugtest","node":"H8fJYusgS9i5y7TZRY4HhQ","reason":{"type":"illegal_argument_exception","reason":"script_lang not supported [groovy]"}}]},"status":400}

What we instead should see is something like this:
{"took":477,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":1.0,"hits":[{"_index":"archbugtest","_type":"doc","_id":"1","_score":1.0,"fields":{"s_obj2_arr2":["arr_value1","arr_value2"],"s_obj2":[{"arr2":["arr_value1","arr_value2"]}],"s_obj1_test":["something"],"s_obj1":[{"test":"something"}]}}]}}%
This task depends upon

Closed by  Massimiliano Torromeo (mtorromeo)
Wednesday, 24 February 2016, 15:08 GMT
Reason for closing:  Fixed
Additional comments about closing:  elasticsearch-2.2.0-4

Loading...