0

I wrote a native plugin for es 5.0, which extends Plugin implements ScriptPlugin, and scripts extends AbstractSearchScript, installed ok, but when I execute the following query:

"script_score": {
    "script": {
      "id": "my_script_factory_name",
      "lang" : "native"
  }
}

It failed with the following error:

{"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,
Andrei Stefan
  • 51,654
  • 6
  • 98
  • 89
navins
  • 3,429
  • 2
  • 28
  • 29

1 Answers1

1

Finally found the cause, the official 5.0 docs is the old version guide, the right query should use inline

"script_score": {
    "script": {
      "inline": "my_script_factory_name",
      "lang" : "native",
      "params": {
        ....
      }
  }
}
navins
  • 3,429
  • 2
  • 28
  • 29