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.
source to share
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
}
}
}'
source to share