How does scoring works?

(Santiago Respane) #1

Hi guys, i dont seem to understand how does ES scoring works.

I have a three values in a field:
-Winged bean.

Why when i perform a wildcard search by bea sorted by score it retrieves the following:

  "buckets": [
      "key": "Soybean",
      "doc_count": 28,
      "max_score": {
        "value": 3.7833919525146484
      "key": "Bean",
      "doc_count": 12,
      "max_score": {
        "value": 4.607567310333252
      "key": "Winged bean",
      "doc_count": 3,
      "max_score": {
        "value": 5.880533218383789

based on levenshtein algorythm, shouldn't be bean closer to bea than Soybean? How does ES scoring works?
How can i perform a sorting by levenshtein distance?
is this possible?

Kind regards,

(Shane Connelly) #2

Elasticsearch performs scoring/sorting based on BM25 by default as of version 5.0. You can use other scoring models, including scripting your own if you like. You could force sorting by levenshtein distance by using different fixed fuzziness along with constant scores in fuzzy query blocks, but it wouldn't be very good.

(system) #3

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