# Is it possible to create a stopword filter, when using tokenizer = " keyword"?

**URL:** <https://discuss.elastic.co/t/is-it-possible-to-create-a-stopword-filter-when-using-tokenizer-keyword/319865>\
**Category:** Elasticsearch\
**Created:** [November 26, 2022, 6:31pm UTC](https://discuss.elastic.co/t/is-it-possible-to-create-a-stopword-filter-when-using-tokenizer-keyword/319865 "2022-11-26T18:31:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivo\_Tavares](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ivo_tavares/32/110022_2.png) [@Ivo\_Tavares](https://discuss.elastic.co/u/Ivo_Tavares)\
**Post date:** [November 26, 2022, 6:31pm UTC](https://discuss.elastic.co/t/is-it-possible-to-create-a-stopword-filter-when-using-tokenizer-keyword/319865/1 "2022-11-26T18:31:20Z")

</div>

Right now, I'm able to create a working stopword filter in the following way.

```auto
company_name_stopword = ["inc","corp"]
_company_name_stopword_filter = dsl.token_filter("_company_name_stopword_filter",
    type="stop",
    ignore_case = "true",
    stopwords=company_name_stopword
)

_tag_analyzer = dsl.analyzer('tag_analyzer',
    tokenizer="whitespace",
    filter=["lowercase",_company_name_stopword_filter] 
)

response = _tag_analyzer.simulate(
    text = 'Apple Inc',
    using = localhost)
print([t.token for t in response.tokens])

```

The objective is to remove from `text` input and string in the list `company_name_stopword`.

However, the index I'm using, uses `tokenizer="keyword"` instead of `tokenizer="whitespace"`.

Is it possible to create this filter with a keyword tokenizer? I can't change the tokenizer of the index without incurring into potential large behavioural/performance changes...

---

<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:** [December 24, 2022, 6:32pm UTC](https://discuss.elastic.co/t/is-it-possible-to-create-a-stopword-filter-when-using-tokenizer-keyword/319865/2 "2022-12-24T18:32:15Z")

</div>

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