Get max(_score) in function score query


(Ian Neubert) #1

Is it possible to get the maximum _score from all search results inside the
function of a function score query?

For example: https://gist.github.com/ianneub/6a165d3206ad83dfdbdf

This is a simplistic example, but what I might do with the data is include
or not include certain computation in my_computed_score depending on the
max _score.

Thanks!

--
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/11628aa1-48d5-4534-b8dc-74080a9768a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Alexander Reelsen) #2

Hey,

will the max score_mode help you here or did I misunderstand your question?
See
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html#_using_function_score

Or do you want to reuse that maximum score inside of a computation of the
function score? That wont work iirc...

--Alex

On Wed, Mar 19, 2014 at 4:34 PM, Ian Neubert ian@ianneubert.com wrote:

Is it possible to get the maximum _score from all search results inside
the function of a function score query?

For example: https://gist.github.com/ianneub/6a165d3206ad83dfdbdf

This is a simplistic example, but what I might do with the data is include
or not include certain computation in my_computed_score depending on the
max _score.

Thanks!

--
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/11628aa1-48d5-4534-b8dc-74080a9768a5%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/11628aa1-48d5-4534-b8dc-74080a9768a5%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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/CAGCwEM-n39i4O0QOHP7rXnoZWd05Cy%2BqxZH80TSc4a-%2BzS2OzA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(Ian Neubert) #3

Thank you for your reply Alex.

I'm actually trying to use the max score inside of the computation--the
MVEL script function--inside the function score query.

On Monday, March 31, 2014 12:02:38 AM UTC-7, Alexander Reelsen wrote:

Hey,

will the max score_mode help you here or did I misunderstand your
question? See
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html#_using_function_score

Or do you want to reuse that maximum score inside of a computation of the
function score? That wont work iirc...

--Alex

On Wed, Mar 19, 2014 at 4:34 PM, Ian Neubert <i...@ianneubert.com<javascript:>

wrote:

Is it possible to get the maximum _score from all search results inside
the function of a function score query?

For example: https://gist.github.com/ianneub/6a165d3206ad83dfdbdf

This is a simplistic example, but what I might do with the data is
include or not include certain computation in my_computed_score depending
on the max _score.

Thanks!

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/11628aa1-48d5-4534-b8dc-74080a9768a5%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/11628aa1-48d5-4534-b8dc-74080a9768a5%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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/4b47c4db-910e-4e14-bafb-7f12cd11c032%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #4