Hello!
I am creating a custom plugin and when making this query I have this error.
JSON
GET example_event/_search
{
"query": {
"bool" : {
"filter" : {
"script" : {
"script" : {
"source": "notHasExpired",
"lang": "native",
"params": {
"field": "recurrent_date"
}
}
}
}
}
}
}
Error
"caused_by": {
"type": "general_script_exception",
"reason": "Failed to compile inline script [notHasExpired] using lang [native]",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "native scripts can not be used for context [filter]"
}
}
If code
if (context.equals(SearchScript.CONTEXT) == false) {
//throw new IllegalArgumentException(getType() + " scripts cannot be used for context [" + context.name + "]");
}
where compile receives
ScriptName: notHasExpired
scriptSource: notHasExpired
ContextType: native
ContextName: filter
SearchScript.CONTEXT: org.elasticsearch.script.ScriptContext@3e5d4f6b
if I delete the condition of "SearchScript.CONTEXT == false" I have an error of "org.elasticsearch.script.FilterScript $ Factory" but I am using it is "SearchScript.Factory factory = hasAnyOccurrenceBetween :: new;"
Do you have any idea why?