# Most popular term for lowercase forms (multivalue field)

**URL:** <https://discuss.elastic.co/t/most-popular-term-for-lowercase-forms-multivalue-field/141707>\
**Category:** Elasticsearch\
**Created:** [July 26, 2018, 7:22am UTC](https://discuss.elastic.co/t/most-popular-term-for-lowercase-forms-multivalue-field/141707 "2018-07-26T07:22:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vladimir\_Khil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vladimir_khil/32/33756_2.png) [@Vladimir\_Khil](https://discuss.elastic.co/u/Vladimir_Khil)\
**Post date:** [July 26, 2018, 7:22am UTC](https://discuss.elastic.co/t/most-popular-term-for-lowercase-forms-multivalue-field/141707/1 "2018-07-26T07:22:12Z")

</div>

Hello!

Is there a way of retrieving most frequent term for all distinct lowercase values of some multivalue string field in Elastic? I need to create a dictionary matching lowercase forms to their most popular uppercase analogues. This dictionary would be used to display user-friendly labels describing possible field values in faceted seach UI.

Terms + top\_hits aggregation does not work because field is multivalue. And I did not found a way to refer to the term key inside inner top\_hits aggregation to filter out irrelevant values.

Nested aggregation could help but storing all distinct values of the field as separate documents seems to be unefficient.

Thank you.

---

<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:** [August 23, 2018, 7:22am UTC](https://discuss.elastic.co/t/most-popular-term-for-lowercase-forms-multivalue-field/141707/2 "2018-08-23T07:22:14Z")

</div>

Closed on August 23, 2018, 7:22am UTC

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