I want to sort the search hits based on two criteria - (1) value of an
attribute, and (2) _score. The first criteria is such that if the attribute
has two values "open" and "closed", the search hits with value "open"
should be ranked above those with value "closed". What is the best way to
do this in ES?
One approach I tried was to invert the score for search hits with value
"closed" using a function_score query. Though this works, there are two
issues - (1) search hits with value "closed" are ranked in the reverse
order of their score, (2) this approach does not allow handling more than
two values of the attribute. Is there a better way to do this in ES?
I want to sort the search hits based on two criteria - (1) value of an
attribute, and (2) _score. The first criteria is such that if the attribute
has two values "open" and "closed", the search hits with value "open"
should be ranked above those with value "closed". What is the best way to
do this in ES?
One approach I tried was to invert the score for search hits with value
"closed" using a function_score query. Though this works, there are two
issues - (1) search hits with value "closed" are ranked in the reverse
order of their score, (2) this approach does not allow handling more than
two values of the attribute. Is there a better way to do this in ES?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.