Date range query using year


Hi All,

I need a date range query for which input will be only year, but in the response, it should contain all the documents within that year like.
Find the below example,

"startDate": {
"type": "date",
"format": "yyyy-MM-dd||yyyy-MM||yyyy"

While indexing data into ES, this field may contain different values like below,

  1. 2017
  2. 2017-09
  3. 2017-08-23
    So, with the below query, when i am searching i am getting only one document as response.

Could someone please help me on writing the query which gets all the documents containing 2014 as well as 2014-09-20.

Ram Prasad G


Did anyone has any clue on this requirement please.
Let me know if you need further more information.


(David Pilato) #3

Read this and specifically the "Also be patient" part.

It's fine to answer on your own thread after 2 or 3 days (not including weekends) if you don't have an answer.


Thank you very much David, for your valuable information.
I was expecting something from some of us, as I was in hurry for my project.

Prasad G

(system) closed #5

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