I am trying to get a list of records from my Elasticsearch client using C#. Within my Elasticsearch index I have a field called startdate. I am looking to query a date range based off this code.
List<Employee> respose = Connection.EsClient().Search<Employee>(s => s .Index("employee") .AllTypes() .From(0) .Query(q => q .DateRange(c => c .Field("startdate") .Format("yyyy-MM-dd") .GreaterThanOrEquals("2015/01/01") .LessThanOrEquals("2015/01/15") ) ) ).Documents.ToList();
When I run this code nothing returns back from Elasticsearch. Also, if I increase the date range it returns back everything which is incorrect. It is kind of like it is ignoring the DateRange filter. I am currently running Elasticsearch 6.4.2. Anything helps, thanks!