Returns documents matching a positive
query while reducing the relevance score of documents that also match a negativ
query.
GET /_search
{
"query": {
"boosting": {
"positive": {
"term": {
"text": "apple"
}
},
"negative": {
"term": {
"text": "pie tart fruit crumble tree"
}
},
"negative_boost": 0.5
}
}
}
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 relevance score of matching documents.
If a returned document matches the positive
query and this query, the boosting
query calculates the final relevance score for the document as follows:
positive
query.negative_boost
value.negative_boost
- (Required, float) Floating point number between 0
and 1.0
used to decrease the relevance scores of documents matching the negative
query.
Returns every matching document with a relevance score equal to the boost
parameter value.
GET /_search
{
"query": {
"constant_score": {
"filter": {
"term": { "user.id": "kimchy" }
},
"boost": 1.2
}
}
}