Bucketize document score based on values of an attribute

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.5max_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 elasticsearch+unsubscribe@googlegroups.com.
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.

I have almost same problem. Have you found any solution?

--
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/6642d644-fa7c-4e74-9b5e-865e82636eb1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.