我为es 5.0编写了一个原生插件,其中extends Plugin implements ScriptPlugin
和脚本extends AbstractSearchScript
安装正常,但是当我执行以下查询时:
"script_score": {
"script": {
"id": "my_script_factory_name",
"lang" : "native"
}
}
失败并出现以下错误:
{"error":{"root_cause":[{"type":"resource_not_found_exception","reason":"Unable to find script [native/my_script_factory_name] in cluster state"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,
答案 0 :(得分:1)
终于找到了原因,官方5.0文档是旧版本指南,正确的查询应该使用内联
"script_score": {
"script": {
"inline": "my_script_factory_name",
"lang" : "native",
"params": {
....
}
}
}