Average bucket is not working

I use average bucket to calculate tps.

First, Working case
aggregation: average bucket
bucket: date histogram, field: @timestamp, minimum interval: second
metric: count

this case, is ok.
inspect:


The calculation process looks like below......

  1. count per bucket
  2. calculate average count
    3. average count / minimum interval: second(3h = 10800)

Second, Not Working case
aggregation: average bucket
bucket: date histogram, field: @timestamp, minimum interval: second
metric: unique count, field: primary key field

inspect:


The calculation process looks like below......
1.unique count per bucket
2. calculate average unique count

why don't calculate process 3???
(average unique count /minimum interval: second(3h = 10800)

Hi @Yungyoung_Ok
I've tested locally and I can reproduce this behaviour. Unfortunately it seems a bug. Do you mind to open an issue here: https://github.com/elastic/kibana/issues/new?template=Bug_report.md

The problem seems exactly the one you highlighted: the 1 aggregation value (67.162162 or 16.405) is the average of the returned buckets. The interval is internally reconfigured to a safer value (from a bucket every second to a 3h bucket). When the interval is reconfigured, we should divide the average but that number. This happens for the standard count but not for the unique unfortunately