2013-08-28 19:24:34 -04:00
|
|
|
[[query-dsl-boosting-query]]
|
2015-06-03 19:59:22 -04:00
|
|
|
=== Boosting Query
|
2013-08-28 19:24:34 -04:00
|
|
|
|
|
|
|
The `boosting` query can be used to effectively demote results that
|
|
|
|
match a given query. Unlike the "NOT" clause in bool query, this still
|
|
|
|
selects documents that contain undesirable terms, but reduces their
|
|
|
|
overall score.
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
2016-05-24 05:58:43 -04:00
|
|
|
GET /_search
|
2013-08-28 19:24:34 -04:00
|
|
|
{
|
2016-05-24 05:58:43 -04:00
|
|
|
"query": {
|
|
|
|
"boosting" : {
|
|
|
|
"positive" : {
|
|
|
|
"term" : {
|
|
|
|
"field1" : "value1"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"negative" : {
|
|
|
|
"term" : {
|
|
|
|
"field2" : "value2"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"negative_boost" : 0.2
|
|
|
|
}
|
2013-08-28 19:24:34 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
2016-05-24 05:58:43 -04:00
|
|
|
// CONSOLE
|