nest - Elasticsearch date range filter does not give proper results with gte, lte -
its been observed lte , gte both take lower bound values. how make take upper bound lte , lower bound gte??
this how query looks
{ "from": 0, "size": 40, "query": { "filtered": { "filter": { "bool": { "should": [ { "range": { "createdon": { "lte": "201505", "gte": "201404", "format": "yyyymm" } } } ] } } } } }
the above query not return me valid documents such "2015-05-06t12:55:34.44", "2015-05-26t14:42:24.963" etc. returns "2015-05-01t11:42:24.963" lte 201505
201404
means april 1st 2014201505
means may 1st 2015
this reason why result. elasticsearch "translates" in background query range 1 1396310400000 1430524799999
, meaning 01 apr 2014 00:00:00 gmt 01 may 2015 23:59:59 gmt
.
if want between entire month of april 2014 , entire month of may 2015, use this:
"range": { "createdon": { "lte": "201506||-1d/d", "gte": "201404", "format": "yyyymm" } }
Comments
Post a Comment