scriptFilter with indexed scripts using JavaApi 1.6/1.7


(Eliran Moyal) #1

Hey
I'm using the JavaApi to query elasticsearch
I'm using the ScriptFilterBuilder to create the query, but it doesn't have an option for pre-indexed scripts or I can't find it...
it only create a "script" field but i need "script_id" in order to run the "hour_between" script.

"filter": {
"script": {
"script": "hour_between",
"lang": "groovy",
"params": {
"field": "insert_time",
"start": 16,
"end": 17
}
}
}

what i need is

"filter": {
"script": {
"script_id": "hour_between",
"lang": "groovy",
"params": {
"field": "insert_time",
"start": 16,
"end": 17
}
}
}

Any way of doing this on JavaApi?
Thanks,
Eliran


(system) #2