Total aggregations

How can I get total aggregations without set the size to 1000000 and get the length of buckets?
please help.

See the composite aggregation

Thanks