Custom score using the max and the min of two fields

hi all,

I need to redefine the score in my search result.
The formula I want to use is something like:

"script" : "0.5 * ((doc['priceMin'].value - priceMin) / (priceMax -
priceMin)) + 0.5 *(1 - ((doc['rank'].value - rankMin) / (rankMin -
rankMax)))",
"params" : {
"rankMin" : 1,
"priceMin" : 1,
"rankMax" : 5,
"priceMax" : 130
}

But I want replace the params with calculated value, where rankMin and
priceMin are the min values for related fields in my index, and rankMax and
priceMax are the max values for related fields in my index

Someone know how I can do it?

thanks,
Davide

--
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.

But I want replace the params with calculated value, where rankMin and
priceMin are the min values for related fields in my index, and
rankMax and priceMax are the max values for related fields in my index

First you'll need to calculate those values using a statistics facet,
then you can pass them as parameters.

You can't do it all in one request

clint

Someone know how I can do it?

thanks,
Davide

--
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.

--
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.