# Does Edge Ngram Token filter creates Synonym for tokens?

**URL:** <https://discuss.elastic.co/t/does-edge-ngram-token-filter-creates-synonym-for-tokens/336572>\
**Category:** Elasticsearch\
**Created:** [June 21, 2023, 12:03pm UTC](https://discuss.elastic.co/t/does-edge-ngram-token-filter-creates-synonym-for-tokens/336572 "2023-06-21T12:03:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Farnaz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/farnaz/32/122541_2.png) [@Farnaz](https://discuss.elastic.co/u/Farnaz)\
**Post date:** [June 21, 2023, 12:03pm UTC](https://discuss.elastic.co/t/does-edge-ngram-token-filter-creates-synonym-for-tokens/336572/1 "2023-06-21T12:03:42Z")

</div>

ave added Edge Ngram Token Filter to my analyzer, **ngram\_back\_fa**. Here is my analyzer:

```auto
"ngram_back_fa": {
                    "tokenizer": "standard",
                    "filter": [
                        "lowercase",
                        "decimal_digit",
                        "trim",
                        "reverse",
                        "edge_ngram_filter",
                        "reverse"
                    ]
                }

```

I have added Edge Ngram Token Filter to my analyzer, **ngram\_back\_fa**. Here is my analyzer:

```auto
"ngram_back_fa": {
                    "tokenizer": "standard",
                    "filter": [
                        "lowercase",
                        "decimal_digit",
                        "trim",
                        "reverse",
                        "edge_ngram_filter",
                        "reverse"
                    ]
                }

```

Here is my filed, **title\_en** :

```auto
"title_en": {
                "type": "text",
                "analyzer": "title_en_analyzer",
                "boost": 40,
                "fields": {
                    "with_back_ngram": {
                        "type": "text",
                        "analyzer": "ngram_back_en",
                        "boost": ngram_boost
                    }
                }
            }

```

And my search query is like this:

```auto
{
     "query": {
            "dis_max": {
                "queries": [
                    {
                        "multi_match": {
                            "query": "HomeComing",
                            "type": "best_fields",
                                "title_en.with_back_ngram"
                                ]
                        }
                    }
                ]
            }
        }
    
}

```

When I use Explain API to see how this analyzer is calculating my score I see that apparently, the tokens that are generated by **token filter** are like **Synonym** of the original tokens and therefore the score are really low. You can see the result of Explain API in the below image:

 ![Screenshot from 2023-06-20 18-52-18](https://us1.discourse-cdn.com/elastic/original/3X/a/d/ad04951d7cc68fc49221761e98d343e1125dbf53.png)

How Can I make elastic to stop this and treat this tokens (generated by **token filter** ) the sane way it treats with the token generated by **tokenizer**?

---

<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:** [July 19, 2023, 12:04pm UTC](https://discuss.elastic.co/t/does-edge-ngram-token-filter-creates-synonym-for-tokens/336572/2 "2023-07-19T12:04:41Z")

</div>

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