Elasticsearch multi-sort possible?

I have been tripping over finding a way to run a sort on a set of results by 2 or more attributes. Most likely "_score" plus something else.

Sample record values:

  1. _score:100, price:50, size:25
  2. _score:100, price:40, size:40
  3. _score:100, price:45, size:30
  4. _score:90, price:48, size:100
  5. _score:90, price:70, size:50

If sorting by _score (desc) then price (desc), I would expect the ordering:
1, 3, 2, 5, 4 (results grouped by _score, subsorted by price desc; 1,2,3 will stay together, as will 4,5, but I would like to affect the ordering within those groups)

If sorting by _score (desc) then size (desc), I would expect the ordering:
2, 3, 1, 4, 5

I imagine that this is possible, but I have not yet found the correct method. Can anyone help me out? Thanks!!!

sort supports providing several (ordered) fields to sort on: Elasticsearch Platform — Find real-time answers at scale | Elastic.

On Tuesday, January 31, 2012 at 6:41 PM, rrgrzcool wrote:

I have been tripping over finding a way to run a sort on a set of results by
2 or more attributes. Most likely "_score" plus something else.

Sample record values:

  1. _score:100, price:50, size:25
  2. _score:100, price:40, size:40
  3. _score:100, price:45, size:30
  4. _score:90, price:48, size:100
  5. _score:90, price:70, size:50

If sorting by _score (desc) then price (desc), I would expect the ordering:
1, 3, 2, 5, 4 (results grouped by _score, subsorted by price desc; 1,2,3
will stay together, as will 4,5, but I would like to affect the ordering
within those groups)

If sorting by _score (desc) then size (desc), I would expect the ordering:
2, 3, 1, 4, 5

I imagine that this is possible, but I have not yet found the correct
method. Can anyone help me out? Thanks!!!

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/elasticsearch-multi-sort-possible-tp3703936p3703936.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com (http://Nabble.com).

Try this http://awesomism.co.uk/536336

On Wednesday, February 1, 2012 3:16:15 PM UTC+4, kimchy wrote:

sort supports providing several (ordered) fields to sort on:
Elasticsearch Platform — Find real-time answers at scale | Elastic.

On Tuesday, January 31, 2012 at 6:41 PM, rrgrzcool wrote:

I have been tripping over finding a way to run a sort on a set of results
by
2 or more attributes. Most likely "_score" plus something else.

Sample record values:

  1. _score:100, price:50, size:25
  2. _score:100, price:40, size:40
  3. _score:100, price:45, size:30
  4. _score:90, price:48, size:100
  5. _score:90, price:70, size:50

If sorting by _score (desc) then price (desc), I would expect the ordering:
1, 3, 2, 5, 4 (results grouped by _score, subsorted by price desc; 1,2,3
will stay together, as will 4,5, but I would like to affect the ordering
within those groups)

If sorting by _score (desc) then size (desc), I would expect the ordering:
2, 3, 1, 4, 5

I imagine that this is possible, but I have not yet found the correct
method. Can anyone help me out? Thanks!!!

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/elasticsearch-multi-sort-possible-tp3703936p3703936.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.