Hello,
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.
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!
Would you be able to generate the JSON that is being sent for this query? It is difficult to diagnose any problems from the C# without seeing what the client library is actually sending.
By the way, I am also seeing this same behavior in Postman. For example: Request:
{
"query": {
"range" : {
"startdate" : {
"format": "mm/dd/yyyy hh:mm:ss",
"gte": "02/08/2016 11:25:06",
"lt": "03/08/2016 11:25:06"
}
}
}
}
Just realized the startdate 'type' is set to text. I will probably need to change this to date to fixed this issue. The index data was pulled from a SQL database which was parsed to Elasticsearch using Logstash. The data type for 'startdate' within SQL is of type datetime.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.