Numeric Range Query Usage

edit

Fluent DSL example

edit
q
.Range(c => c
    .Name("named_query")
    .Boost(1.1)
    .Field(p => p.Description)
    .GreaterThan(1.0)
    .GreaterThanOrEquals(1.1)
    .LessThan(2.1)
    .LessThanOrEquals(2.0)
    .Relation(RangeRelation.Within)
)

Object Initializer syntax example

edit
new NumericRangeQuery
{
    Name = "named_query",
    Boost = 1.1,
    Field = "description",
    GreaterThan = 1.0,
    GreaterThanOrEqualTo = 1.1,
    LessThan = 2.1,
    LessThanOrEqualTo = 2.0,
    Relation = RangeRelation.Within
}

Example json output.

{
  "range": {
    "description": {
      "_name": "named_query",
      "boost": 1.1,
      "gt": 1.0,
      "gte": 1.1,
      "lt": 2.1,
      "lte": 2.0,
      "relation": "within"
    }
  }
}