Dismax Query Usage

edit

Fluent DSL example

edit
q
.DisMax(c => c
    .Name("named_query")
    .Boost(1.1)
    .TieBreaker(0.11)
    .Queries(
        qq => qq.MatchAll(m => m.Name("query1")),
        qq => qq.MatchAll(m => m.Name("query2"))
    )
)

Object Initializer syntax example

edit
new DisMaxQuery()
{
    Name = "named_query",
    Boost = 1.1,
    TieBreaker = 0.11,
    Queries = new QueryContainer[]
    {
        new MatchAllQuery() { Name = "query1" },
        new MatchAllQuery() { Name = "query2" },
    }
}

Example json output.

{
  "dis_max": {
    "_name": "named_query",
    "boost": 1.1,
    "queries": [
      {
        "match_all": {
          "_name": "query1"
        }
      },
      {
        "match_all": {
          "_name": "query2"
        }
      }
    ],
    "tie_breaker": 0.11
  }
}