elasticsearch/elasticsearch — Issue #1561: Query DSL: custom_filters_score allow nesting of boosts with operators
Author: jaysonminard
Created: 2011-12-22 07:18:36+00:00
State: open

In relevancy cases there are things like:

* given a starting query
* for situation A and B, multiply score by the highest of A or B producing new score
* for situation C, D and E multiply score by the highest of those producing a new score
* for situation F and G, discount score by the worst discount producing a new score

So you have groups of queries. Which right now you have to nest custom_filters_score to accomplish (or combine with boosts DSL for the negative and still nest queries).

In the custom_filters_score DSL would be nice to nest the filters part in groups, using the mode as the grouping. These should be grouped with operators "multiply", "max", "min", "sum" or "total", "avg"...

```json
{
"custom_filters_score" : {
"query" : {
"match_all" : {}
},
"filters" : {
"multiply" : [
{
"max" : [
{
"filter" : { "term" : { "myfield" : "datavalue" } },
"boost" : 3
},
{
"filter" : { "term" : { "myfield_alt" : "differentvalue" } },
"boost" : 2
}
]
},
{
"min" : [
{
"filter" : { "term" : { "danger" : "badValue" } },
"boost" : 0.5
},
{
"filter" : { "term" : { "badfield" : "horrible" } },
"boost" : 0.1
}
]
}
]
}
}
}
```