A newer version is available. For the latest information, see the
current release documentation.
Date Range Query Usage
editDate Range Query Usage
editFluent DSL example
editq .DateRange(c => c .Name("named_query") .Boost(1.1) .Field(p => p.Description) .GreaterThan(FixedDate) .GreaterThanOrEquals(DateMath.Anchored(FixedDate).RoundTo(DateMathTimeUnit.Month)) .LessThan("01/01/2012") .LessThanOrEquals(DateMath.Now) .Format("dd/MM/yyyy||yyyy") .TimeZone("+01:00") )
Object Initializer syntax example
editnew DateRangeQuery { Name = "named_query", Boost = 1.1, Field = "description", GreaterThan = FixedDate, GreaterThanOrEqualTo = DateMath.Anchored(FixedDate).RoundTo(DateMathTimeUnit.Month), LessThan = "01/01/2012", LessThanOrEqualTo = DateMath.Now, TimeZone = "+01:00", Format = "dd/MM/yyyy||yyyy" }
Example json output.
{ "range": { "description": { "_name": "named_query", "boost": 1.1, "format": "dd/MM/yyyy||yyyy", "gt": "2015-06-06T12:01:02.123", "gte": "2015-06-06T12:01:02.123||/M", "lt": "01/01/2012", "lte": "now", "time_zone": "+01:00" } } }