# Combining ngram tokenizer with stopwords

**URL:** <https://discuss.elastic.co/t/combining-ngram-tokenizer-with-stopwords/357303>\
**Category:** Elasticsearch\
**Created:** [April 12, 2024, 3:33pm UTC](https://discuss.elastic.co/t/combining-ngram-tokenizer-with-stopwords/357303 "2024-04-12T15:33:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dimitri\_Gamkrelidze](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dimitri_gamkrelidze/32/122479_2.png) [@Dimitri\_Gamkrelidze](https://discuss.elastic.co/u/Dimitri_Gamkrelidze)\
**Post date:** [April 12, 2024, 3:33pm UTC](https://discuss.elastic.co/t/combining-ngram-tokenizer-with-stopwords/357303/1 "2024-04-12T15:33:41Z")

</div>

Helllo everyone

I'm trieing to create custom tokenizer with ngram.

```auto
GET /_analyze
{
 "tokenizer": {
    "type":"ngram",
    "min_gram":3,
    "max_gram":3,
    "token_chars": [
    "letter",
    "digit",
    "punctuation",
    "symbol",
    "whitespace"
  ]
  },
  "filter": [ {
    "type":"stop",
    "ignore_case":true,
    "stopwords":[
      "HELP"
      ]
  }
  ,{
    "type":"ngram",
    "min_gram":3,
    "max_gram":3
  }
  ],
  "text": "HELP TEST VALUE"
}

```

Of course it's not filtering the "HELP" out, because ngram tokenizer splitted before filter,  
If I use "type":"standard in tokenizer, then ngram filter works, but tokenizer produces result that is not what we want, ngram works only filter on the result.

Can someone help in this case?

Thanks

---

<div class="post-metadata">

**Author:** ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)\
**Post date:** [April 12, 2024, 7:16pm UTC](https://discuss.elastic.co/t/combining-ngram-tokenizer-with-stopwords/357303/2 "2024-04-12T19:16:39Z")

</div>

Hi @Dimitri_Gamkrelidze

According to the [documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/analyzer-anatomy.html), the behavior is correct.  
What do you expect as a result? I believe you can create a tokenizer other than Ngram to generate the tokens. Use ngram only in the filter step.
