navins
navins

Reputation: 3469

elasticsearch 5.0 native plugin, query error

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,

Upvotes: 0

Views: 232

Answers (1)

navins
navins

Reputation: 3469

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": {
        ....
      }
  }
}

Upvotes: 1

Related Questions