# Passing varied parameters to BMI25 instead of 1 set

**URL:** https://discuss.elastic.co/t/passing-varied-parameters-to-bmi25-instead-of-1-set/105626
**Category:** Elasticsearch
**Created:** [October 28, 2017, 3:13am UTC](https://discuss.elastic.co/t/passing-varied-parameters-to-bmi25-instead-of-1-set/105626 "2017-10-28T03:13:33Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![ESlearner](https://avatars.discourse-cdn.com/v4/letter/e/898d66/32.png) [@ESlearner](https://discuss.elastic.co/u/ESlearner)
#### Post date: [October 28, 2017, 3:13am UTC](https://discuss.elastic.co/t/passing-varied-parameters-to-bmi25-instead-of-1-set/105626/1 "2017-10-28T03:13:33Z")

</div>

Continuing the discussion from [Tweaking BM25 parameters efficiently](https://discuss.elastic.co/t/tweaking-bm25-parameters-efficiently/15487):

I was wondering if its possible to pass multiple k1 and b values to BMI25 in order to determine the ideal parameters , instead of going through the pain of doing one at a time. Any help is much appreciated.

---

<div class="post-metadata">

### Author: ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)
#### Post date: [October 28, 2017, 4:39pm UTC](https://discuss.elastic.co/t/passing-varied-parameters-to-bmi25-instead-of-1-set/105626/2 "2017-10-28T16:39:45Z")

</div>

It should be possible to close an index, change settings and then reopen it. Alternatively, you can index the same field several times with different similarities. This will increase the index size, but you will be able to clearly see the difference in a single query:

```auto
PUT test
{
  "settings": {
    "number_of_shards": 1,
    "similarity": {
      "my_similarity_1": {
        "type": "BM25",
        "k1": 1,
        "b": 1
      },
      "my_similarity_2": {
        "type": "BM25",
        "k1": 0.5,
        "b": 0.5
      }
    }
  },
  "mappings": {
    "doc": {
      "properties": {
        "my_text": {
          "type": "text",
          "fields": {
            "sim_1": {
              "type": "text",
              "similarity": "my_similarity_1"
            },
            "sim_2": {
              "type": "text",
              "similarity": "my_similarity_2"
            }
          }
        }
      }
    }
  }
}

GET test/doc/_msearch
{}
{"query" : {"match" : {"my_text": "test terms"}}}
{}
{"query" : {"match" : {"my_text.sim_1": "test terms"}}}
{}
{"query" : {"match" : {"my_text.sim_2": "test terms"}}}

```

... or you can use combination of both. This way you can test several similarities at the same time for each open/close.

---

<div class="post-metadata">

### Author: ![softwaredoug](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/softwaredoug/32/22681_2.png) [@softwaredoug](https://discuss.elastic.co/u/softwaredoug)
#### Post date: [October 28, 2017, 5:03pm UTC](https://discuss.elastic.co/t/passing-varied-parameters-to-bmi25-instead-of-1-set/105626/3 "2017-10-28T17:03:39Z")

</div>

see this issue. I’d love this feature!

> <https://github.com/elastic/elasticsearch/issues/6727>

---

<div class="post-metadata">

### Author: ![ESlearner](https://avatars.discourse-cdn.com/v4/letter/e/898d66/32.png) [@ESlearner](https://discuss.elastic.co/u/ESlearner)
#### Post date: [October 31, 2017, 3:05am UTC](https://discuss.elastic.co/t/passing-varied-parameters-to-bmi25-instead-of-1-set/105626/4 "2017-10-31T03:05:24Z")

</div>

Thanks you so much , worked like a charm...

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [November 28, 2017, 3:05am UTC](https://discuss.elastic.co/t/passing-varied-parameters-to-bmi25-instead-of-1-set/105626/5 "2017-11-28T03:05:35Z")

</div>

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