# Disable score for multiple matched ngrams

**URL:** <https://discuss.elastic.co/t/disable-score-for-multiple-matched-ngrams/114220>\
**Category:** Elasticsearch\
**Created:** [January 5, 2018, 7:11am UTC](https://discuss.elastic.co/t/disable-score-for-multiple-matched-ngrams/114220 "2018-01-05T07:11:58Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mstkk](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@mstkk](https://discuss.elastic.co/u/mstkk)\
**Post date:** [January 5, 2018, 7:11am UTC](https://discuss.elastic.co/t/disable-score-for-multiple-matched-ngrams/114220/1 "2018-01-05T07:11:58Z")

</div>

```
"_source": {
          "suggestion_id": "35_8_14",
          "suggestion_headerText": "İzmir kiralık Konut",
          "suggestion_hierarchy": "İzmir > kiralık > Konut",
          "suggestion_detailUrl": "?city=35&category=8",
          "suggestion_webUrl": "/satilik/izmir",
          "suggestion_locationOrder": 1,
          "suggestion_categoryOrder": "1",
          "suggestion_kindOrder": "1"
        },
"_source":{
         "suggestion_id": "482_35_8_15",
          "suggestion_headerText": "Kiraz Kiralık Konut",
          "suggestion_hierarchy": "İzmir > Kiraz > Kiralık > Konut",
          "suggestion_detailUrl": "?town=482&city=35&category=8",
          "suggestion_webUrl": "/kiralik/izmir-kiraz",
          "suggestion_locationOrder": 1482,
          "suggestion_categoryOrder": 1,
          "suggestion_kindOrder": 2

}

```

GET /db/suggestions/\_search

```
{
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "suggestion_hierarchy": "izmir kiralık"
          }
        }
      ]
    }
  },
  "sort": [
       "_score", 
      {
      "suggestion_locationOrder": {
        "order": "asc"
      }
    },
    {
      "suggestion_kindOrder": {
        "order": "asc"
      }
    },
    {
      "suggestion_kindOrder": {
        "order": "asc"
      }
    }
  ],
  "size": 5
   
}

```

first my analyzer is edge\_ngram , i want to see first "İzmir \> kiralık \> Konut" document but i cant because of score "kir" in "kiraz" and "kiralık" i dont want to override score im using it how can i prevent multiple ngram match's to the score

---

<div class="post-metadata">

**Author:** ![mstkk](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@mstkk](https://discuss.elastic.co/u/mstkk)\
**Post date:** [January 5, 2018, 2:42pm UTC](https://discuss.elastic.co/t/disable-score-for-multiple-matched-ngrams/114220/3 "2018-01-05T14:42:09Z")

</div>

me neither

---

<div class="post-metadata">

**Author:** ![mstkk](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@mstkk](https://discuss.elastic.co/u/mstkk)\
**Post date:** [January 23, 2018, 11:17am UTC](https://discuss.elastic.co/t/disable-score-for-multiple-matched-ngrams/114220/4 "2018-01-23T11:17:27Z")

</div>

any help ? unique token filter didnt help

---

<div class="post-metadata">

**Author:** ![mstkk](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@mstkk](https://discuss.elastic.co/u/mstkk)\
**Post date:** [February 9, 2018, 2:49pm UTC](https://discuss.elastic.co/t/disable-score-for-multiple-matched-ngrams/114220/5 "2018-02-09T14:49:33Z")

</div>

well ?

---

<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:** [February 9, 2018, 3:11pm UTC](https://discuss.elastic.co/t/disable-score-for-multiple-matched-ngrams/114220/6 "2018-02-09T15:11:03Z")

</div>

Can you post a complete reproduction of your problem, not just bits and pieces?

---

<div class="post-metadata">

**Author:** ![mstkk](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@mstkk](https://discuss.elastic.co/u/mstkk)\
**Post date:** [February 13, 2018, 11:41am UTC](https://discuss.elastic.co/t/disable-score-for-multiple-matched-ngrams/114220/7 "2018-02-13T11:41:00Z")

</div>

document field =\> "Kiraz Kiralık Konut"  
search\_text =\> "kira"  
result =\> **kira** z **kira** lık konut

i want to only find ngram once and score it one time only  
when " Kiraz Kiralık Konut" scored by multiple because its include 2 times "kir" my search algorithm break  
İzmir kiralık konut has lower score then "Kiraz Kiralık Konut"  
and Kiralık Konut has lower score then "Kiraz Kiralık Konut"  
its all about ngrams multiple times found on field

---

<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:** [February 13, 2018, 2:37pm UTC](https://discuss.elastic.co/t/disable-score-for-multiple-matched-ngrams/114220/8 "2018-02-13T14:37:54Z")

</div>

Please see [this post](https://www.elastic.co/help) for more information on how to ask effective questions on this forum.

> [@mstkk](#):
>
> its all about ngrams multiple times found on field

I think this is an oversimplification of the issue. If this is the only problem, you can solve it by expressing each term in your query as a separate match query wrapped into a [constant score query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-constant-score-query.html), or you can switch to not using n-gram for your search and using it only for indexing, or you can add an additional search for exact match and give it higher boost. There are plenty of options with slightly different outcomes, but based on your description I can only guess what the problem is (you probably used n-gram for both searching and indexing instead of just indexing) and what you want to achieve.

---

<div class="post-metadata">

**Author:** ![mstkk](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@mstkk](https://discuss.elastic.co/u/mstkk)\
**Post date:** [February 15, 2018, 6:30am UTC](https://discuss.elastic.co/t/disable-score-for-multiple-matched-ngrams/114220/9 "2018-02-15T06:30:05Z")

</div>

okey thank you

---

<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:** [March 15, 2018, 6:30am UTC](https://discuss.elastic.co/t/disable-score-for-multiple-matched-ngrams/114220/10 "2018-03-15T06:30:06Z")

</div>

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