# Edge-ngram and irrelevant scoring

**URL:** <https://discuss.elastic.co/t/edge-ngram-and-irrelevant-scoring/221397>\
**Category:** Elasticsearch\
**Created:** [February 28, 2020, 9:51am UTC](https://discuss.elastic.co/t/edge-ngram-and-irrelevant-scoring/221397 "2020-02-28T09:51:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![slim-souissi](https://avatars.discourse-cdn.com/v4/letter/s/2acd7d/32.png) [@slim-souissi](https://discuss.elastic.co/u/slim-souissi)\
**Post date:** [February 28, 2020, 9:51am UTC](https://discuss.elastic.co/t/edge-ngram-and-irrelevant-scoring/221397/1 "2020-02-28T09:51:04Z")

</div>

Hello ,  
I'm applying edge-ngram as index toxenizer . My problem is that when a term matches , it matches so many times on the same field . As a consequence , the score become too high and irrelevant.  
Here is an example : when i search for the word "Hystorique" i match the value "Consultation\_Hystorique\_Clients\_Recherches" which is correct . but here is the highlights :

> ```
> "highlight": {
> "data.content": [
> "Consultation_<em>Hys</em><em>t</em><em>o</em><em>r</em><em>i</em><em>q</em><em>u</em><em>e</em>_Clients_Recherches"
> ]
> > }.
> 
> ```

here is my analyzer:

```
"analysis": {
          "analyzer": {
            "autocomplete": {
              "tokenizer": "autocomplete",
              "filter": ["lowercase"]
            }
          },
          "tokenizer": {
            "autocomplete": {
              "type": "edge_ngram",
              "min_gram": 3,
              "max_gram": 50,
              "token_chars": [
                "letter","digit","letter_number","uppercase_letter","line_separator"
              ],"custom_token_chars": ["_","-"]
            }
          }
        }
      },

```

thanks in advance.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 28, 2020, 12:38pm UTC](https://discuss.elastic.co/t/edge-ngram-and-irrelevant-scoring/221397/2 "2020-02-28T12:38:25Z")

</div>

I think you should define in the mapping a `simple` `search_analyzer` for your field.  
This might help.

I shared an example at the very end of this gist:

> <https://gist.github.com/dadoonet/f911291c4dd19b0802031db3064c648f>

---

<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 27, 2020, 12:38pm UTC](https://discuss.elastic.co/t/edge-ngram-and-irrelevant-scoring/221397/3 "2020-03-27T12:38:26Z")

</div>

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