Configuring BM25 affinity in Elasticsearch

Elasticsearch documentation I can change the similarity for all fields by adding the following to elasticsearch.yml

:

index.similarity.default.type: BM25

      

.. which I did, but I also want to fine tune the field length normalization, which he says I can do here: http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/pluggable- similarites.html # bm25-tunability

But that doesn't tell me where / how to set the parameters k1

and b

. Is there a line I can add in elasticsearch.yml

to achieve this?

Thank.

+2


source to share


2 answers


You can check this document pointing out how you can customize BM25 affinity

Essentially you can define your own similarity to bm25, similar to custom parsers in the index setting



Example:

 curl -XPUT "http://<server>/<index>" -d '
{
  "settings": {
    "similarity": {
      "custom_bm25": { 
        "type": "BM25",
        "b":    0 ,
         "k1" : 0.9

      }
    }
  }'

      

+3


source


This is how my elasticsearch.yml file looks like. This is with elasticsearch-2.3.2.

index :
  similarity:
    default:
      type: BM25
      b: 0.75
      k1: 1.2

      



Also, here is a good reference for choosing settings.

+1


source







All Articles