Lowercase analyzer and aggregation sort

Hello everybody,
I think I'm wrong using Elastic custom analyzer (version 1.7 :frowning: ).

I use a lowercase analyzer to sort a field in case insensitive way. I found a problem when I analyze the aggregations (I need them to see the list of values). I see aggregation values in lowercase. If I try to query the not analyzed field in the aggregations, I see the difference between upper and lowercase letters but the sort no (first the words that starts with uppercase words and after the lowercase).

There is a way to solve the problem?


Use multi fields. So you will have 2 versions of the same field, one for full text search and another one for aggs.

Note that will be kind of mandatory approach when you will upgrade to 6.x or 7.x.
And I'd really recommend to upgrade!

thanks for the reply. The problem is: if I use the second rappresentation of the field for aggs, how can I sort the aggs case insensitive?

Not sure if there's a better option but in modern versions you can add an inner top_hits agg and display the first hit of each bucket from which you can retrieve the original value non formatted.

with top_hits I have the values in correct case form from the aggregation. But the structure is complex and I have to do some stuff backend side.

No other simple method is available for my task? :frowning:


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