elasticsearch 5.0原生插件,查询错误

时间:2016-10-31 06:03:31

标签: elasticsearch elasticsearch-plugin elasticsearch-5

我为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,

1 个答案:

答案 0 :(得分:1)

终于找到了原因,官方5.0文档是旧版本指南,正确的查询应该使用内联

"script_score": {
    "script": {
      "inline": "my_script_factory_name",
      "lang" : "native",
      "params": {
        ....
      }
  }
}