Max score from boolean query parts


(JS) #1

For a nested query, it is possible to get the max value of the subterms:

"nested" : {
    "path" : "subdocs",
    "score_mode" : "max",
    "query" : {
        "bool": {
            "disable_coord": True,
            "should": [
                query_1, # Score = 5
                query_2, # Score = 8
                query_3 # Score = 10
            ]
        }
    }
}

This would return 10.

I would like to do this with a not nested boolean query:

"bool": {
    "disable_coord": True,
    "should": [
        query_1, # Score = 5
        query_2, # Score = 8
        query_3 # Score = 10
    ]
}

should return 10.

Is this possible?


(Sumit Jain) #2

You can use dis_max query to get this behavior.


(system) #3