# Inconsistent aggregation results

**URL:** <https://discuss.elastic.co/t/inconsistent-aggregation-results/207006>\
**Category:** Elasticsearch\
**Created:** [November 7, 2019, 8:03pm UTC](https://discuss.elastic.co/t/inconsistent-aggregation-results/207006 "2019-11-07T20:03:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pinkus13](https://avatars.discourse-cdn.com/v4/letter/p/59ef9b/32.png) [@pinkus13](https://discuss.elastic.co/u/pinkus13)\
**Post date:** [November 7, 2019, 8:03pm UTC](https://discuss.elastic.co/t/inconsistent-aggregation-results/207006/1 "2019-11-07T20:03:11Z")

</div>

Hi  
I am trying to run a terms aggregation to return a list of unique values. But each time I run the aggregation I get a different number of buckets returned.  
I have terms aggregation which has a sub aggregation to give me the top 5 values for each unique term.  
Top level aggregation varies the number of buckets returned every time I run it. It has a size set to 1000 and from what I can work out when it works it returns about 269 results but can returns less buckets.  
Am I not understanding a how Elasticsearch does aggregations or am I doing something stupid. Should I be using a composite aggregation to page through the results instead with a smaller size?  
Am querying daily indices over about 30 days. Each index has 3 shards and 1 replica on 13 data nodes.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 5, 2019, 8:03pm UTC](https://discuss.elastic.co/t/inconsistent-aggregation-results/207006/2 "2019-12-05T20:03:16Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
