You are looking at documentation for an older release.
Not what you want? See the
current release documentation.
Boosting Query Usageedit
Fluent DSL Exampleedit
q
.Boosting(c => c
.Name("named_query")
.Boost(1.1)
.Positive(qq => qq.MatchAll(m => m.Name("filter")))
.Negative(qq => qq.MatchAll(m => m.Name("query")))
.NegativeBoost(1.12)
)Object Initializer Syntax Exampleedit
new BoostingQuery()
{
Name = "named_query",
Boost = 1.1,
PositiveQuery = new MatchAllQuery { Name ="filter" },
NegativeQuery= new MatchAllQuery() { Name = "query" },
NegativeBoost = 1.12
}Example json output.
{
"boosting": {
"_name": "named_query",
"boost": 1.1,
"negative": {
"match_all": {
"_name": "query"
}
},
"negative_boost": 1.12,
"positive": {
"match_all": {
"_name": "filter"
}
}
}
}