Hi All,
I need some clarification, whether I am doing correct or wrong. I have below two queries.
Query1:
"aggs": {
"previous_aggr": {
"nested": {
"path": "prevFin"
},
"aggs": {
"prev_aggr": {
"date_range": {
"field": "prevFin.statDate",
"ranges": [
{
"from": "2015-01-01",
"to": "2015-12-31"
}
]
}
}
}
}
}
Response:
"prev_aggr": {
"buckets": [
{
"key": "2015-01-01-2015-12-31",
"from": 1420070400000,
"from_as_string": "2015-01-01",
"to": 1451520000000,
"to_as_string": "2015-12-31",
"doc_count": 6509
}
]
}
Query2:
"query": {
"nested": {
"path": "prevFin",
"query": {
"range": {
"prevFin.statDate": {
"gte": "2015-01-01",
"lt": "2015-12-31"
}
}
}
}
}
Response:
"total": 6503
I came to know from ES doc that, To is excluded from Range Aggregation query.
But how to get the same count for both Date Range Query and Date Range Aggregation Query.
Can we get the same count for both queries.
Could Someone please explain this.
Thanks,
Ram