# How to only use score of best matching term

**URL:** <https://discuss.elastic.co/t/how-to-only-use-score-of-best-matching-term/253317>\
**Category:** Elasticsearch\
**Created:** [October 26, 2020, 1:58pm UTC](https://discuss.elastic.co/t/how-to-only-use-score-of-best-matching-term/253317 "2020-10-26T13:58:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JF2018](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@JF2018](https://discuss.elastic.co/u/JF2018)\
**Post date:** [October 26, 2020, 1:58pm UTC](https://discuss.elastic.co/t/how-to-only-use-score-of-best-matching-term/253317/1 "2020-10-26T13:58:57Z")

</div>

Hey

I have four terms, Term\_A, Term\_B, Term\_C and Term\_D.  
I would like to do something like this:

```auto
   {
      "query": {
        "bool" : {
          "should" : [
            { "term" : { "tags_field" : "Term_A" } },
            { "term" : { "tags_field" : "Term_B" } },
            { "term" : { "tags_field" : "Term_C" } },
            { "term" : { "tags_field" : "Term_D" } }
          ],
          "minimum_should_match" : 1,
          "boost" : 1.0,
          "score_mode": max
        }
      }
    }

```

Where the score\_mode part should say, that I only want the document to get the score of the best matching term.  
I am aware of multi-field search, but that is one queryString to multiple fields.  
What I wish here is multiple queryStrings, and only get score from the best matching.

Appreciate all the help I can get 🙂

(We are using elastic 1.7, but if there is a simple solution I havn't thought about, it will probably work on this old version as well 🤞)

/Jens

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [October 26, 2020, 3:36pm UTC](https://discuss.elastic.co/t/how-to-only-use-score-of-best-matching-term/253317/2 "2020-10-26T15:36:37Z")

</div>

Hi Jens.  
Check out the [dis max](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-dis-max-query.html) query.

> [@JF2018](#):
>
> We are using elastic 1.7,

Whoah. Might be time for an upgrade 🙂

---

<div class="post-metadata">

**Author:** ![JF2018](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@JF2018](https://discuss.elastic.co/u/JF2018)\
**Post date:** [October 26, 2020, 3:53pm UTC](https://discuss.elastic.co/t/how-to-only-use-score-of-best-matching-term/253317/3 "2020-10-26T15:53:43Z")

</div>

Hi Mark

That is exactly what I was looking for, thanks! 🙂

And yes, it has been on our backlog for years 😅

---

<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 23, 2020, 3:53pm UTC](https://discuss.elastic.co/t/how-to-only-use-score-of-best-matching-term/253317/4 "2020-11-23T15:53:53Z")

</div>

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