Avg function score query only for matching filter


#1

Hi all,

Is there a way when using multiple filters in function score query to have the score mode "avg" only compute the average on the matching filters ?

My mapping is ( extract )

        "popularity": {
        "type": "nested",
        "include_in_parent": true,
        "properties": {
            "value": {
                "type": "integer"
            },
            "countryCode":{
                "type": "string",
                "index": "not_analyzed"
            }
        }
    }

Documents contains X popularity objects with different country codes and a World Wide country code, i want to use the avg of local country and world wide as boost to the query score. The problem is that if one document is missing the local country the value for World Wide will be divided by 2.

Thanks
Ruben Chadien


(system) #2