Constant Score Query Usage

edit

Fluent DSL example

edit
q
.ConstantScore(c => c
    .Name("named_query")
    .Boost(1.1)
    .Filter(qq => qq.MatchAll(m => m.Name("filter")))
)

Object Initializer syntax example

edit
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"
      }
    }
  }
}