Terms List Query Usageedit

Fluent DSL exampleedit

q
.Terms(c => c
    .Name("named_query")
    .Boost(1.1)
    .Field(p => p.Description)
    .DisableCoord()
    .MinimumShouldMatch(MinimumShouldMatch.Fixed(2))
    .Terms(new List<string> { "term1", "term2" })
)

Object Initializer syntax exampleedit

new TermsQuery
{
    Name = "named_query",
    Boost = 1.1,
    Field = "description",
    Terms = new List<string> { "term1", "term2" },
    DisableCoord = true,
    MinimumShouldMatch = 2
}

Example json output.

{
  "terms": {
    "_name": "named_query",
    "boost": 1.1,
    "description": [
      "term1",
      "term2"
    ],
    "disable_coord": true,
    "minimum_should_match": 2
  }
}

Fluent DSL exampleedit

q
.Terms(c => c
    .Name("named_query")
    .Boost(1.1)
    .Field(p => p.Description)
    .DisableCoord()
    .Terms(_terms)
)

Object Initializer syntax exampleedit

new TermsQuery
{
    Name = "named_query",
    Boost = 1.1,
    Field = "description",
    Terms = _terms,
    DisableCoord = true,
}

Example json output.

{
  "terms": {
    "_name": "named_query",
    "boost": 1.1,
    "description": [
      [
        "term1",
        "term2"
      ]
    ],
    "disable_coord": true
  }
}

Fluent DSL exampleedit

q
.Terms(c => c
    .Name("named_query")
    .Boost(1.1)
    .Field(p => p.NumberOfCommits)
    .DisableCoord()
    .Terms(_terms)
)

Object Initializer syntax exampleedit

new TermsQuery
{
    Name = "named_query",
    Boost = 1.1,
    Field = "numberOfCommits",
    Terms = _terms,
    DisableCoord = true,
}

Example json output.

{
  "terms": {
    "_name": "named_query",
    "boost": 1.1,
    "numberOfCommits": [
      [
        "term1",
        "term2"
      ]
    ],
    "disable_coord": true
  }
}