Script_score: the script could not be loaded

I am trying to write a custom scoring plugin (for elasticsearch 5.6.2.) by following the example mentioned here

https://www.elastic.co/guide/en/elasticsearch/reference/5.6/modules-scripting-engine.html

I packaged my plugin using maven and installed it in elasticsearch. When i start elasticsearch, i see the message "my_plugin" loaded.

But when i issue a query similar to the one mentioned in the above url, I get the following error message

org.elasticsearch.transport.RemoteTransportException: [9410gLh][127.0.0.1:9300][indices:data/read/search[phase/query]]
Caused by: org.elasticsearch.index.query.QueryShardException: script_score: the script could not be loaded
	at org.elasticsearch.index.query.functionscore.ScriptScoreFunctionBuilder.doToFunction(ScriptScoreFunctionBuilder.java:100) ~[elasticsearch-5.6.2.jar:5.6.2]
	at org.elasticsearch.index.query.functionscore.ScoreFunctionBuilder.toFunction(ScoreFunctionBuilder.java:137) ~[elasticsearch-5.6.2.jar:5.6.2]
	at org.elasticsearch.index.query.functionscore.FunctionScoreQueryBuilder.doToQuery(FunctionScoreQueryBuilder.java:304) ~[elasticsearch-5.6.2.jar:5.6.2]
	at org.elasticsearch.index.query.AbstractQueryBuilder.toQuery(AbstractQueryBuilder.java:96) ~[elasticsearch-5.6.2.jar:5.6.2]
	at org.elasticsearch.index.query.QueryShardContext.lambda$toQuery$1(QueryShardContext.java:313) ~[elasticsearch-5.6.2.jar:5.6.2]
.
.
.
Caused by: java.lang.IllegalArgumentException: script_lang not supported [expert_scripts]
	at org.elasticsearch.script.ScriptService.getScriptEngineServiceForLang(ScriptService.java:189) ~[elasticsearch-5.6.2.jar:5.6.2]
	at org.elasticsearch.script.ScriptService.compile(ScriptService.java:261) ~[elasticsearch-5.6.2.jar:5.6.2]
	at org.elasticsearch.script.ScriptService.search(ScriptService.java:491) ~[elasticsearch-5.6.2.jar:5.6.2]
	at org.elasticsearch.index.query.QueryShardContext.getSearchScript(QueryShardContext.java:345) ~[elasticsearch-5.6.2.jar:5.6.2]
	at org.elasticsearch.index.query.functionscore.ScriptScoreFunctionBuilder.doToFunction(ScriptScoreFunctionBuilder.java:97) ~[elasticsearch-5.6.2.jar:5.6.2]

Can anyone give me a hint on whats wrong ?

Thanks
Srini

I figured it out. I forgot to implement ScriptPlugin. The example mentioned in the above url, should be enclosed like this

public class ExpertScriptPlugin extends Plugin implements ScriptPlugin {

    @Override
    public ScriptEngineService getScriptEngineService(Settings settings) {
        return new MyExpertScriptEngine();
    }

   /* class given in the example */
   private static class MyExpertScriptEngine implements ScriptEngineService {
   }
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.