Boost value on a boolean field


I have a field indexed as a boolean. I wonder if there is a way to boost the document when this value is true and not boost it when the value is false.

I can't find a way to do it.


Welcome djean,
I guess function_score should work as your expected way.

Thank you wangqinghuan for your reply. You mean something like that:

     GET /_search
         "query": {
             "function_score": {
               "query": { "match_all": {} },
               "functions": [
                       "filter": { "match": { "test": false} },
                       "weight": 23
                       "filter": { "match": { "test": true } },
                       "weight": 42


This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.