Facets and Multiple Sorts

(Erich Lin) #1

Do facets support either:

  1. Deterministic/stable sorting if there are equal values
  2. If not, a way to allow this using multiple sorts. Sort first by A, then
    if A's are equal, sort by B.

This is my query:

POST /some_index/_search
"query": {
"filtered": {
"query": {
"match_all": {}
"facets": {
"facet_name": {
"terms_stats": {
"key_field": "bucket_id",
"value_field": "price",
"order": "mean",
"size": 100

If bucket_id 90 , 91 .... 100, 101.. 105 all have the same mean price, then

  1. would I potentially get a different result set each time because of a
    non-deterministic sort?
  2. If so, how do I change this specific query to order first by mean price
    and then SECOND by bucket_id.

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/58efd436-1595-4ba1-bfb5-3f9ae757bb77%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

(system) #2