I just wonder that if i can exclude doc counts calculating when i get aggregations. Because at the moment i don't need doc counts. Does Elasticsearch make an extra effort to calculate doc counts on aggregation, or basically works like sql group by inside ?
The doc count is very low cost to calculate since it is just maintaining and incrementing a single long for each bucket. The cost of maintaining and updating sub aggregations for each bucket will be much more than this so it shouldn't significantly impact the performance of your aggregation request.
2 Likes