I have the following query which returns wrong result (all the sum buckets =175!), and I don't have a clue why.. assistance will be appreciated.
I'm 99% sure that it didn't happen with Elastic 1.7 (we have just upgraded)
GET org_aggregations...*/.../_search
{
"query": {
"bool": {
"filter": [
{
"ids": {
"values": [
"AVqE7pJdCQ_f2txT8s4x"
]
}
}
]
}
},
"aggs": {
"create_date": {
"date_histogram": {
"field": "create_date",
"interval": "day"
},
"aggs": {
"greater_than_val_time": {
"terms": {
"script": {
"lang": "groovy",
"inline": "_source.histogram_time_distribution.histogram_timegreater_than_val"
},
"size": 20
},
"aggs": {
"recurrences": {
"sum": {
"field": "histogram_time_distribution.histogram_timedoc_count22"
}
}
}
}
}
}
}
}
the only doc retrieved from the bool filter is:
{
"_index": "..",
"_type": "...",
"_id": "AVqE7pJdCQ_f2txT8s4x",
"_source": {
"doc_count11": 175,
"page_views": 88,
"histogram_dns_time_distribution": [
{
"histogram_dns_timegreater_than_val": 0,
"histogram_dns_timedoc_count22": 175,
"avg": 0
}
],
"histogram_time_distribution": [
{
"histogram_timegreater_than_val": 0,
"histogram_timedoc_count22": 161,
"avg": 193.17391304347825
},
{
"histogram_timegreater_than_val": 1000,
"histogram_timedoc_count22": 7,
"avg": 1323.142857142857
},
{
"histogram_timegreater_than_val": 2000,
"histogram_timedoc_count22": 4,
"avg": 2270
},
{
"histogram_timegreater_than_val": 3000,
"histogram_timedoc_count22": 0,
"avg": null
},
...
],
"resource_domain": "stats.g.doubleclick.net",
"resource_path": "/r/collect",
"create_date": "2017-02-25T00:00:00"
}
}
the strange result is: (all the sum buckets =175!)
"aggregations": {
"create_date": {
"buckets": [
{
"key_as_string": "2017-02-25T00:00:00.000Z",
"key": 1487980800000,
"doc_count": 1,
"greater_than_val_time": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 6,
"buckets": [
{
"key": "0",
"doc_count": 1,
"recurrences": {
"value": 175
}
},
{
"key": "1000",
"doc_count": 1,
"recurrences": {
"value": 175
}
},
{
"key": "10000",
"doc_count": 1,
"recurrences": {
"value": 175
}
},
....
}
]
}
}
]
}
}