1
votes

I have a very specific order I would like facets returned in. I see that the default for elastic search is count, and optionally you can do term which is alphabetical. (see: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets.html)

Besides doing the sort in my application I was curios if there was a way of sorting the facets in the order I want them on the ES side.

1
What is the order that you want to use?Dan Tuffery
In any arbitrary predefined order.Cory
Would be very nice if there is a solution for this! If I understand it right, you would like to see the facet options in the sidebar in a specific order? Cause you could link it with an Analytics system which returns the most popular facet on top. It looks like you can order them: blog.qbox.io/migrating-from-facets-to-aggregationsErik van de Ven

1 Answers

0
votes

Can't say about any arbitrary order, but if you have something in your document to order to be relied upon, you can sort documents in query/filter/aggregation before picking up facets. By the way, don't use facets at all - aggregations are faster (by ten times in my case) and more powerful along with almost same syntax. The catch is, ordering can change search results if there are more than "top results".