onebirdrocks / geektime-ELK

ELK Training
1.21k stars 2.54k forks source link

terms聚合"doc_count_error_upper_bound" : 0,但是数据存在较大误差 #15

Closed DivenYoung closed 4 years ago

DivenYoung commented 4 years ago

阮老师好: 我通过stats聚合获取max和min来算用量,在query中使用的terms query,用terms aggregation来分组,但是发现使用date_histogram 将12月的数据sum 和 直接interval 为年的数据相差很大,但是课程里面讲的观察"doc_count_error_upper_bound" 发现值又是0 就不太明白会是什么地方的问题 "aggs": { "date": { "date_histogram": { "field": "timestamp", "interval": "month" or "year" }, "aggs": { "device": { "terms": { "field": "label.deviceId", "show_term_doc_count_error": true }, "aggs": { "stats": { "stats": { "field": "value" } } } }