I am writing a function in a function_score query to alter the default 
score of a document based on the value of an attribute. For example, if an 
attribute "status" has two values "open" and "closed" and I want search 
hits with "open" status to be ranked higher than those with "closed" 
status. 

My current idea is to scale the score of a search hit to a scale of 0 to 
(0.5*max_score) for records with "closed" status and scale of 
(0.5*max_score to max_score) for records with "open" status. This will make 
open records to rank higher than closed records. This requires max_score to 
be known in the function script. 

Questions - 
1) How to access max_score of a search hit in the function script? 
2) Is there an alternate way to achieve the above ranking?

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/0eb4594c-4f7f-48b6-8521-1cefe83f0e81%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to