Reputation: 5088
Using Elasticsearch 1.4.4, I have this script -
doc[field].date.getMinuteOfDay() >= gte && doc[field].date.getMinuteOfDay() <= lte
Stored here - config/script/minuteOfDayRange.groovy
I run this query:
POST test_index/_search
{
"filter": {
"script": {
"script_file": "minuteOfDayRange",
"params": {
"field": "start_time",
"gte": 0,
"lte": 1439
}
}
},
"size": 0
}
and get an error. Here is part of the error (it's really big so I tried to show only the parts that looked the most helpful):
"error": "SearchPhaseExecutionException[Failed to execute phase [query], all shards failed;......nested: QueryParsingException[[test_index] [script] filter does not support [script_file]];......
It sounds like this part of the error with [script] filter does not support [script_file] is saying script filters don't work with script_file. Is that correct? I've used script_file to generate terms with success on this same index. Previous to updating to 1.4.4 this same filter worked using dynamic scripts, but I am now using the script_file method since updating to 1.4.4. Is it possible for me to use a script filter in a file, and if so, how?
Upvotes: 1
Views: 922
Reputation: 5088
It worked by changing script_file to just script in the query.
I found a similar issue on github that was a clue to try this: https://github.com/elastic/elasticsearch/issues/10007
Upvotes: 1