[[query-dsl-boosting-query]]
=== Boosting query
++++
Boosting
++++
Returns documents matching a `positive` query while reducing the
<> of documents that also match a
`negative` query.
You can use the `boosting` query to demote certain documents without
excluding them from the search results.
[[boosting-query-ex-request]]
==== Example request
[source,js]
----
GET /_search
{
"query": {
"boosting" : {
"positive" : {
"term" : {
"text" : "apple"
}
},
"negative" : {
"term" : {
"text" : "pie tart fruit crumble tree"
}
},
"negative_boost" : 0.5
}
}
}
----
// CONSOLE
[[boosting-top-level-params]]
==== Top-level parameters for `boosting`
`positive`::
(Required, query object) Query you wish to run. Any returned documents must
match this query.
`negative`::
+
--
(Required, query object) Query used to decrease the <> of matching documents.
If a returned document matches the `positive` query and this query, the
`boosting` query calculates the final <> for
the document as follows:
. Take the original relevance score from the `positive` query.
. Multiply the score by the `negative_boost` value.
--
`negative_boost`::
(Required, float) Floating point number between `0` and `1.0` used to decrease
the <> of documents matching the
`negative` query.