Elasticsearch multiple range query for date

Input data ::
{"group": {"item_1":1,"item_2":33205,"item_3":0},
"FINAL_OUTPUT": [{"load_dt":"2017-06-06","item_1":1,"item_2":33205,"item_3":0,"str":1935,"Cprc":287.99,"type":"A","stadt":"2017-06-04","stpdt":"2017-06-10","Xprc":0.0,"Rprc":479.99},
{"load_dt":"2017-06-06","item_1":1,"item_2":33205,"item_3":0,"str":1925,"Cprc":287.99,"type":"A","stadt":"2017-06-04","stpdt":"2017-06-10","Xprc":0.0,"Rprc":479.99},
{"load_dt":"2017-06-06","item_1":1,"item_2":33205,"item_3":0,"str":1915,"Cprc":287.99,"type":"A","stadt":"2017-06-04","stpdt":"2017-06-10","Xprc":0.0,"Rprc":479.99},
{"load_dt":"2017-06-06","item_1":1,"item_2":33205,"item_3":0,"str":490,"Cprc":479.99,"type":"B","stadt":"2007-12-20","stpdt":"9999-12-31","Xprc":0.0,"Rprc":479.99},
{"load_dt":"2017-06-06","item_1":1,"item_2":33205,"item_3":0,"str":9928,"Cprc":479.99,"type":"R","stadt":"2012-08-24","stpdt":"9999-12-31","Xprc":0.0,"Rprc":479.99},
{"load_dt":"2017-06-06","item_1":1,"item_2":33205,"item_3":0,"str":1945,"Cprc":287.99,"type":"A","stadt":"2017-06-04","stpdt":"2017-06-10","Xprc":0.0,"Rprc":479.99},
{"load_dt":"2017-06-06","item_1":1,"item_2":33205,"item_3":0,"str":1905,"Cprc":287.99,"type":"A","stadt":"2017-06-04","stpdt":"2017-06-10","Xprc":0.0,"Rprc":479.99}

My Seach query ::
GET /group_idx/history/_search
{
"query": {
"nested" : {
"path" : "FINAL_OUTPUT",
"query": {
"bool": {
"must": [
{
"range": { "FINAL_OUTPUT.stadt": { "gte" : "2017-06-04" } }
},
{
"range": { "FINAL_OUTPUT.stpdt": { "lte" : "2017-06-10" } }
}
]
}
}
}
}
}

In output i am getting wrong result ::
{
"load_dt": "2017-06-06",
"item_1": 1,
"item_2": 33205,
"item_3": 0,
"str": 490,
"Cprc": 479.99,
"type": "B",
"stadt": "2007-12-20",
"stpdt": "9999-12-31",
"Xprc": 0,
"Rprc": 479.99
},

Please suggest how to resolve this ?

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