# How to make terms aggregation case insensitive?

**URL:** <https://discuss.elastic.co/t/how-to-make-terms-aggregation-case-insensitive/100746>\
**Category:** Elasticsearch\
**Created:** [September 16, 2017, 4:07am UTC](https://discuss.elastic.co/t/how-to-make-terms-aggregation-case-insensitive/100746 "2017-09-16T04:07:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![patrickian](https://avatars.discourse-cdn.com/v4/letter/p/c57346/32.png) [@patrickian](https://discuss.elastic.co/u/patrickian)\
**Post date:** [September 16, 2017, 4:07am UTC](https://discuss.elastic.co/t/how-to-make-terms-aggregation-case-insensitive/100746/1 "2017-09-16T04:07:13Z")

</div>

I have a field called user\_name. Examples of entries are "user", "User" and "someuser". When I aggrrgate by terms, the result treats "user" and "User" as 2 different results. Rightly so, for obvious reasons. However, is there a way for Elasticsearch to treat them as the same? Even if the entry would be "user", "User", "uSeR" or "UsEr", aggregations would fall to the same bucket "USER". Thanks in advance.

---

<div class="post-metadata">

**Author:** ![loren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/loren/32/44942_2.png) [@loren](https://discuss.elastic.co/u/loren)\
**Post date:** [September 18, 2017, 5:05am UTC](https://discuss.elastic.co/t/how-to-make-terms-aggregation-case-insensitive/100746/2 "2017-09-18T05:05:14Z")

</div>

See [https://www.elastic.co/guide/en/elasticsearch/reference/master/normalizer.html](https://www.elastic.co/guide/en/elasticsearch/reference/master/normalizer.html)

---

<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:** [October 16, 2017, 5:05am UTC](https://discuss.elastic.co/t/how-to-make-terms-aggregation-case-insensitive/100746/3 "2017-10-16T05:05:21Z")

</div>

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