Alphabetical ordering on terms aggregation


(Henrik Ossipoff Hansen) #1

We have a use case using Elasticsearch that seems pretty standard, but
we're having a hard time solving.

Say we have an index with products in it, each having a brand. This field
contains both the analyzed version as well as a raw version for
faceting/aggregation. So far so good.

Let's imagine these values for different brands, spread across products:

A
Bob
bOok
C
D

So far so good - now we do a simple terms aggregation on brand.raw with
ordering set to _terms in ascending ordering.

What comes from this is all the uppercase versions first, and "bOok" at the
bottom of the list. I fully understand why this is the case, but to my
experience, this is unatural to most people. Especially concerning brand
ordering, where many brands use stylized casing of their brand name - but
you don't really want them listed any different ordering wise. What I would
expect of ordering, is the ordering listed above in my example (A, Bob,
bOok, C, D).

Does anyone know a way to actually make this happen, or has some
suggestions as to the direction we could look in achieving this?

Thank you.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/8b08a001-bc49-4668-b314-90b1e8bd2ecc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Jörg Prante) #2

I discussed this issue - which is more than upper/lowercase, it's sorting
by collation key as an alternative to canoical sort order - at

https://github.com/elasticsearch/elasticsearch/issues/3300Mock#issuecomment-21211672

"For example, I need german phone book sorting order not only in sorting
fields but also in facet entries. "

Still hoping that (ICU or java.text.Collator key based) collation sort will
make it into the aggregation entries.

An alternative for me to achieve ICU based collation key order is to patch
the ICU plugin which I did in the past before 1.0.

Jörg

On Sat, Mar 29, 2014 at 10:35 PM, Henrik Ossipoff Hansen <
henrik.ossipoff@gmail.com> wrote:

We have a use case using Elasticsearch that seems pretty standard, but
we're having a hard time solving.

Say we have an index with products in it, each having a brand. This field
contains both the analyzed version as well as a raw version for
faceting/aggregation. So far so good.

Let's imagine these values for different brands, spread across products:

A
Bob
bOok
C
D

So far so good - now we do a simple terms aggregation on brand.raw with
ordering set to _terms in ascending ordering.

What comes from this is all the uppercase versions first, and "bOok" at
the bottom of the list. I fully understand why this is the case, but to my
experience, this is unatural to most people. Especially concerning brand
ordering, where many brands use stylized casing of their brand name - but
you don't really want them listed any different ordering wise. What I would
expect of ordering, is the ordering listed above in my example (A, Bob,
bOok, C, D).

Does anyone know a way to actually make this happen, or has some
suggestions as to the direction we could look in achieving this?

Thank you.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/8b08a001-bc49-4668-b314-90b1e8bd2ecc%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/8b08a001-bc49-4668-b314-90b1e8bd2ecc%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoFWtf%2BUEigQtf%2BgxDGx-0MyaEBrpn5qg9Kbc%2Bj9QFjAYQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3