hi every one
Why date Range filter is not working in my code:
public static DateRangeQuery GetSearchFromDate(int DayFrom, int DayTo, int MonthFrom, int MonthTo, int YearFrom, int YearTo, string fieldName)
{
DateTime dateFrom = new(YearFrom, MonthFrom, DayFrom, 0,0,0);
DateTime dateTo = new(YearTo, MonthTo, DayTo, 0,0,0);
return new DateRangeQuery
{
Boost = 1.1,
Field = myfieldName,
GreaterThanOrEqualTo = dateFrom,
LessThanOrEqualTo = dateTo,
TimeZone = "+01:00",
Format = "yyyy/MM/dd"
};
}
[Date]
public DateTime myfieldName{ get; set; }
- sample of date in the elastic:
"myfieldName": "1957-01-10T00:00:00",