Bug in aggregation result when using shards

Some of the aggregations in Elasticsearch are approximate, and this includes the terms aggregation. This trade-off has been made in order to be able to aggregate large data volumes fast, and the reason behind this is explained quite well in this post.