# How to add an analyzer that can remove duplicate tokens from the analyzed field?

**URL:** <https://discuss.elastic.co/t/how-to-add-an-analyzer-that-can-remove-duplicate-tokens-from-the-analyzed-field/322098>\
**Category:** Elasticsearch\
**Created:** [December 28, 2022, 12:45pm UTC](https://discuss.elastic.co/t/how-to-add-an-analyzer-that-can-remove-duplicate-tokens-from-the-analyzed-field/322098 "2022-12-28T12:45:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hemangr8](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hemangr8/32/77147_2.png) [@hemangr8](https://discuss.elastic.co/u/hemangr8)\
**Post date:** [December 28, 2022, 12:45pm UTC](https://discuss.elastic.co/t/how-to-add-an-analyzer-that-can-remove-duplicate-tokens-from-the-analyzed-field/322098/1 "2022-12-28T12:45:00Z")

</div>

I want to add a token filter in my custom analyzer to remove duplicate tokens in the text field while matching.

Eg: Input: "random petrol pump, beside random2 petrol pump"  
After analyzer: ["random", "petrol", "pump", "beside", "random2"]

---

<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:** [January 25, 2023, 12:45pm UTC](https://discuss.elastic.co/t/how-to-add-an-analyzer-that-can-remove-duplicate-tokens-from-the-analyzed-field/322098/2 "2023-01-25T12:45:24Z")

</div>

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