Filter query URI in elasticsearch based on dates

Not able to filter the elasticsearch data based on dates. Not able to correctly figure out the syntax.
Have tried all below given queries.

localhost:9200/index/_search?q=date:>=2019-01-01  
localhost:9200/index/_search?q=date:>=2019-01-01 00:00:00.0
localhost:9200/index/_search?q=date:>=2019-01-01T00:00:00.0

Need to fetch all the docs that have date > 2019-01-01 00:00:00.

Error: "type":"parse_exception","reason":"failed to parse date field [2019-01-01] with format [yyyy-MM-dd HH:mm:ss.S]"}]

hey,

assumption here. The date_format configured in the mapping for the date field is yyyy-MM-dd HH:mm:ss.S and therefore Elasticsearch expects the date field in the query to resemble that format.

A possible alternative here wold be to use a date range query with a customized format.

--Alex

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.