Plug-in Java or Python or Scala function to re-calculate document score?

Hello ElasticSearch experts,

Is it possible to plug-in Java or Python or Scala customized function (any one of them is ok) into ElasticSearch cluster, so that for each returned documents, we can use the customized function to calculate a document score based on fields of documents? And return ordered document based on customized function score?

If so, any samples is appreciated.

thanks in advance,
Lin

See the script_score. You can use a native script if you are ok with deploying it into Elasticsearch's classpath. If its simple enough you can use "expression" which is the Lucene Expression language. Its plenty for lots of use cases and its fast and sandboxed.

Thanks Nik,

Is there a guide how to write a sample native script and deploy into Elasticsearch's class path, and leverage it during query?

BTW, I have another question on customized scoring, and if you could comment, it will be great,

regards,
Lin