I have about 400K documents in ES (3 node cluster), the documents have following format:
{
"@timestamp": "2017-11-21T06:49:39.800Z",
"message": "xxxx",
"username": "xxxx",
"geoip": {
"country_name": "United States",
"region_name": "Washington",
"city_name": "Seattle"
}
}
I am performing nested aggregations using the following query:
{
"size": 0,
"query": {
"bool": {
"must": [
{
"range": {
"@timestamp": {
"gte": "now-90d/d",
"lt": "now/d",
"time_zone": "US/Pacific"
}
}
}
]
}
},
"sort": [
{
"@timestamp": {
"order": "desc"
}
}
],
"aggs": {
"countries": {
"terms": {
"size": 1000000,
"field": "geoip.country_name.keyword"
},
"aggs": {
"regions": {
"terms": {
"size": 1000000,
"field": "geoip.region_name.keyword"
},
"aggs": {
"cities": {
"terms": {
"size": 1000000,
"field": "geoip.city_name.keyword.keyword"
},
"aggs": {
"users": {
"terms": {
"size": 1000000,
"field": "username.keyword"
}
}
}
}
}
}
}
}
}
}
I do get results back for this query and the aggregations are computed. However if I change the time range to target some of the most recent documents for example:
{
"range": {
"@timestamp": {
"gte": "now-2d/d",
"lt": "now/d",
"time_zone": "US/Pacific"
}
}
}
I get hits
back but no aggregations, I can confirm that there is documents matching the time range I provided and the data format has not changed either.
Only thing I can think of is that I recently upgraded to ES 6.1.0
from ES 6.0.0
I found this odd that ES computes aggregations for slice of documents containing older documents but does not compute aggregations for newer documents.
Can anyone point me in the right direction to solve this issue?