Date range query using year


#1

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.

{
"query":{
"range":{
"standardisedFinancials.identification.startDate":{
"gte":"2014",
"lte":"2014"
}
}
}
}
Could someone please help me on writing the query which gets all the documents containing 2014 as well as 2014-09-20.

Thanks,
Ram Prasad G


#2

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

Thanks,
Prasad


(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.


#4

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.

Thanks,
Prasad G


(system) closed #5

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