123456789101112131415161718192021222324252627282930313233343536 |
- [[query-dsl-boosting-query]]
- === Boosting Query
- 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.
- It accepts a `positive` query and a `negative` query.
- Only documents that match the `positive` query will be included
- in the results list, but documents that also match the `negative` query
- will be downgraded by multiplying the original `_score` of the document
- with the `negative_boost`.
- [source,js]
- --------------------------------------------------
- GET /_search
- {
- "query": {
- "boosting" : {
- "positive" : {
- "term" : {
- "field1" : "value1"
- }
- },
- "negative" : {
- "term" : {
- "field2" : "value2"
- }
- },
- "negative_boost" : 0.2
- }
- }
- }
- --------------------------------------------------
- // CONSOLE
|