Hi,
I have created one script file (query2.groovy) containing following content.
_agg["tempArray"] = [];
I have saved this script in some diff folder outside ES (other than config/scripts) on the same server. I am calling this script from query but getting error "Unable to find on disk file script". Below is the query.
{
"query" : {
"match_all" : {}
},
"aggs": {
"expected_revenue": {
"scripted_metric": {
"init_script" : {
"file": "/home/test_user5/apm_105658/query2",
"lang": "groovy"
},
"map_script": "if (doc.metric_name.value == "processor(_total)-% processor time") { _agg.tempArray.add(doc.metric_value.value*10); } ",
"combine_script": "exRevenue = 0; for (i in _agg.tempArray) { exRevenue += i }; return exRevenue;",
"reduce_script": "exRevenue = 0; for (j in _aggs) { exRevenue += j }; return exRevenue;"
}
}
}
}
Is it mandatory that script should be present in config/scripts folder. Please help in resolving this issue.