Most popular term for lowercase forms (multivalue field)

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.

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