I have one date field in my data as
"type": "date",
"format": "dateOptionalTime"
Now My date Field and Value is -
"INITIAL_EXTRACT_DATE" : "2015-04-02T06:47:57.78+05:30"
While searching I am searching based on only date that is "2015-04-02". but I am getting 0 result.
Can anyone suggest how to search exact date and is any of date.
Now I am trying with this -
For Exact Date -
"term": {
"IH_PT_DSC": {
"value": "2015-04-02"
}
}
For Is any of date -
"terms": {
"IH_PT_DSC": [
"2015-04-02",
"2015-04-03",
"2015-04-03"
]
}
You should indeed use a date range query, and a format parameter (but much simpler as explained in the previous answer)
For Exact Date
For Is any of date - use a boolean filter and "should" the different blocks together
You can use a
range
filter for this, by using the same date ingte
/lte
and aformat
parameter where you only specify the date part (i.e. leave out the time part)If you need to specify multiple dates, you can do so easily as well.
Finally, if you need to query disjoint date intervals, simply use a
bool/should
filter: