Closed hagenbauer closed 9 years ago
Hi! Please refer to the Order part of the relevant aggregation, e.g.: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html
Hi @hagenbauer
Did you have any joy with this? I'm trying to sort my facets alphabetically as well but am having trouble.
I've tried something like this
eui-aggregation="ejs.TermsAggregation('country').field('country').size(0).order('country','desc')
But I receive a 500 server error.
Thanks in advance!
@EssentialMusic no, I gave it a try but i was not successfull
If you debug the network request sent and received from ES (Chrome Inspector -> network tab), I might be able to dig in and help
Thanks both for the quick response. I've actually now solved this!
@YousefED I was looking at the network inspector yesterday and got nowhere. Had another look this morning and decided to copy my query into ES-Head to try and debug there and also looking at the ES docs again: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#search-aggregations-bucket-terms-aggregation-order
Basically, where I had .order('country','desc')
I should have been using .order('_term','desc')
Hope this also helps you @hagenbauer
Is there a way to have the facets not sorted by number of documents but alphabeticaly?
Regards
Hagen