Sort Order when relevance is equal


(Erich Lin) #1

Ignoring the bouncing results problem with multiple shards , is the order
of results deterministic when sorting by relevance score or any other
field.

What I mean by this is if two documents have the same score,

  1. will they always be in the same order if we set the preference parameter
    to an arbitrary string like the user’s session ID.
  2. If so, is there a way to predict this deterministic order? Is it done by
    ID of the documents as a tiebreaker etc?
  3. If not, could we specify that or do we have to do a secondary sort on ID
    if we wanted to do that?

--
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/490e4f7f-ce26-4a5f-abe5-9df28b71ddc9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Mateusz Kaczynski-2) #2

Seconding question.

Also, is it possible that the default order for an equal relevance score
changed between 1.0 and 1.2 ? We've noticed seemingly random ordering in
our regression when updating.

On Wednesday, 14 May 2014 00:49:55 UTC, Erich Lin wrote:

Ignoring the bouncing results problem with multiple shards , is the order
of results deterministic when sorting by relevance score or any other
field.

What I mean by this is if two documents have the same score,

  1. will they always be in the same order if we set the preference
    parameter to an arbitrary string like the user’s session ID.
  2. If so, is there a way to predict this deterministic order? Is it done
    by ID of the documents as a tiebreaker etc?
  3. If not, could we specify that or do we have to do a secondary sort on
    ID if we wanted to do that?

--
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/dd34df9d-7ef0-4fec-9f50-2a7e30cfae8e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Mateusz Kaczynski-2) #3

Seconding question.

Also, is it possible that it changed between versions 1.0 and 1.2? We're
trying to upgrade and noticed a seemingly random order of documents with
equal relevance in regression testing.

On Wednesday, 14 May 2014 00:49:55 UTC, Erich Lin wrote:

Ignoring the bouncing results problem with multiple shards , is the order
of results deterministic when sorting by relevance score or any other
field.

What I mean by this is if two documents have the same score,

  1. will they always be in the same order if we set the preference
    parameter to an arbitrary string like the user’s session ID.
  2. If so, is there a way to predict this deterministic order? Is it done
    by ID of the documents as a tiebreaker etc?
  3. If not, could we specify that or do we have to do a secondary sort on
    ID if we wanted to do that?

--
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/284b6bfd-68aa-4717-ab52-73d44f7cc196%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Clinton Gormley) #4

Hi Erich

On 14 May 2014 02:49, Erich Lin elin@onekingslane.com wrote:

  1. will they always be in the same order if we set the preference
    parameter to an arbitrary string like the user’s session ID.

They will be, until a merge happens (eg from indexing, updating, deleting,
or just because...)

  1. If so, is there a way to predict this deterministic order? Is it done
    by ID of the documents as a tiebreaker etc?

It's the order of docs in the Lucene segment

  1. If not, could we specify that or do we have to do a secondary sort on
    ID if we wanted to do that?

Yes, you could provide a secondary sort on _uid (not _id)

Also, is it possible that the default order for an equal relevance score
changed between 1.0 and 1.2 ? We've noticed seemingly random ordering in
our regression when updating.

It shouldn't have - if you can reproduce this, please open an issue.

--
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/CAPt3XKTVcsuHG%3DPup7iPtZsFuX9Pp50SG-Ewor5Ns2WVY2PziQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(system) #5