Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to obtain scoring between 0 and 1 with ElasticSearch?

Currently, I've indexed many documents in ElasticSearch and when I did a search on max score, the number exceeds 1.

How can I obtain a similarity search, which is between 0 and 1 ?

Should I configure ElasticSearch better ? or I should change my mapping?

Thanks in advance for your advices.

like image 252
pi-2r Avatar asked Nov 09 '22 02:11

pi-2r


1 Answers

Lucene scoring is not classical cosinus-similarity function based on tif id vectors, but some modification wich takes into account other factors like boost on field or query terms. You can read a mode details about scoring formula at page. So the simplest way to get scoring between a 0.0 and 1.0, just norm score on max_score from elasticsearch response (it coincides with score of the first document).

like image 108
Alexander Kuznetsov Avatar answered Nov 14 '22 23:11

Alexander Kuznetsov