You are looking at documentation for an older release.
Not what you want? See the
current release documentation.
Constant Score Query Usageedit
Fluent DSL Exampleedit
q
.ConstantScore(c => c
.Name("named_query")
.Boost(1.1)
.Filter(qq => qq.MatchAll(m => m.Name("filter")))
)Object Initializer Syntax Exampleedit
new ConstantScoreQuery()
{
Name = "named_query",
Boost = 1.1,
Filter = new MatchAllQuery { Name = "filter" },
}Example json output.
{
"constant_score": {
"_name": "named_query",
"boost": 1.1,
"filter": {
"match_all": {
"_name": "filter"
}
}
}
}