Score a query with JaroWinkler in ElasticSearch with Java API
Elasticsearch uses lucene under the hood for all scoring. Lucene uses TF/IDF for scoring in versions before 6.0 and versions later than 6.0 use the Bm25 algorithm.
Elasticsearch allows you to write scripts to modify the scores for the hits you have already obtained from lucene but there is no other way of writing a scoring function that is implemented for the initial search. Also trying to modify scores you get has limitations due to pagination of results since the result on the second page might be better result than with your algorithm compared to all the results on the first page.
So the only thing you can really do is write a plugin to do that for elasticsearch/lucene. You should also keep in mind that elasticsearch/lucene use an inverted index so your results still might be not what you want.
Also since the access to the server is not available the short answer to your question is no it can’t be done.
The best you can do is ask for a lot of result and then boost them using scripting.
EDIT: After doing some more research I found that you might be able to something very similar to what you want to do using the function score query of elasticsearch, with help of fuzziness. Although it still wouldn’t change how documents are found (have to deal with inverted indexes and analyzers etc) but you could definitely mess with scoring of the results. Also look at this
Read more here: Source link