Score asc vs desc reversed?


(ppearcy) #1

Heya,
I was playing around with score based scoring and was surprised to
see that a sort=_score:asc returned the scores from highest to lowest,
while sort=_score:desc returns the lowest score to the highest score.

Not sure what can be done at this point to have this make more sense
without breaking a bunch of stuff, but was surprised at how this was
reversed. Most users probably don't specify asc or desc, so get the
correct behavior.

Thanks,
Paul


(Shay Banon) #2

Actually, this only happens on the URI case, and if you pass the order in
the search body, it will work correctly. Opened an issue, will be fixed in
0.17.3: https://github.com/elasticsearch/elasticsearch/issues/1191.

On Tue, Aug 2, 2011 at 1:52 AM, ppearcy ppearcy@gmail.com wrote:

Heya,
I was playing around with score based scoring and was surprised to
see that a sort=_score:asc returned the scores from highest to lowest,
while sort=_score:desc returns the lowest score to the highest score.

Not sure what can be done at this point to have this make more sense
without breaking a bunch of stuff, but was surprised at how this was
reversed. Most users probably don't specify asc or desc, so get the
correct behavior.

Thanks,
Paul


(ppearcy) #3

FYI, I can also reproduce with the Java APIs using the SortBuilders
object.

The call looks like:

		searchBuilder.addSort(SortBuilders.fieldSort(field).order(order));

Let me know if you need any other details

Thanks!
Paul

On Aug 1, 5:53 pm, Shay Banon kim...@gmail.com wrote:

Actually, this only happens on the URI case, and if you pass the order in
the search body, it will work correctly. Opened an issue, will be fixed in
0.17.3:https://github.com/elasticsearch/elasticsearch/issues/1191.

On Tue, Aug 2, 2011 at 1:52 AM, ppearcy ppea...@gmail.com wrote:

Heya,
I was playing around with score based scoring and was surprised to
see that a sort=_score:asc returned the scores from highest to lowest,
while sort=_score:desc returns the lowest score to the highest score.

Not sure what can be done at this point to have this make more sense
without breaking a bunch of stuff, but was surprised at how this was
reversed. Most users probably don't specify asc or desc, so get the
correct behavior.

Thanks,
Paul


(Shay Banon) #4

Yes, you are right, this also applies to the Java API, updated the issue.

On Tue, Aug 2, 2011 at 3:21 AM, ppearcy ppearcy@gmail.com wrote:

FYI, I can also reproduce with the Java APIs using the SortBuilders
object.

The call looks like:

searchBuilder.addSort(SortBuilders.fieldSort(field).order(order));

Let me know if you need any other details

Thanks!
Paul

On Aug 1, 5:53 pm, Shay Banon kim...@gmail.com wrote:

Actually, this only happens on the URI case, and if you pass the order in
the search body, it will work correctly. Opened an issue, will be fixed
in
0.17.3:https://github.com/elasticsearch/elasticsearch/issues/1191.

On Tue, Aug 2, 2011 at 1:52 AM, ppearcy ppea...@gmail.com wrote:

Heya,
I was playing around with score based scoring and was surprised to
see that a sort=_score:asc returned the scores from highest to lowest,
while sort=_score:desc returns the lowest score to the highest score.

Not sure what can be done at this point to have this make more sense
without breaking a bunch of stuff, but was surprised at how this was
reversed. Most users probably don't specify asc or desc, so get the
correct behavior.

Thanks,
Paul


(ppearcy) #5

Thank you!!!

On Aug 1, 11:40 pm, Shay Banon kim...@gmail.com wrote:

Yes, you are right, this also applies to the Java API, updated the issue.

On Tue, Aug 2, 2011 at 3:21 AM, ppearcy ppea...@gmail.com wrote:

FYI, I can also reproduce with the Java APIs using the SortBuilders
object.

The call looks like:

searchBuilder.addSort(SortBuilders.fieldSort(field).order(order));

Let me know if you need any other details

Thanks!
Paul

On Aug 1, 5:53 pm, Shay Banon kim...@gmail.com wrote:

Actually, this only happens on the URI case, and if you pass the order in
the search body, it will work correctly. Opened an issue, will be fixed
in
0.17.3:https://github.com/elasticsearch/elasticsearch/issues/1191.

On Tue, Aug 2, 2011 at 1:52 AM, ppearcy ppea...@gmail.com wrote:

Heya,
I was playing around with score based scoring and was surprised to
see that a sort=_score:asc returned the scores from highest to lowest,
while sort=_score:desc returns the lowest score to the highest score.

Not sure what can be done at this point to have this make more sense
without breaking a bunch of stuff, but was surprised at how this was
reversed. Most users probably don't specify asc or desc, so get the
correct behavior.

Thanks,
Paul


(system) #6