# Can i get bucket count of terms aggregation?

**URL:** <https://discuss.elastic.co/t/can-i-get-bucket-count-of-terms-aggregation/203561>\
**Category:** Elasticsearch\
**Created:** [October 15, 2019, 4:41am UTC](https://discuss.elastic.co/t/can-i-get-bucket-count-of-terms-aggregation/203561 "2019-10-15T04:41:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yungyoung\_Ok](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yungyoung_ok/32/43465_2.png) [@Yungyoung\_Ok](https://discuss.elastic.co/u/Yungyoung_Ok)\
**Post date:** [October 15, 2019, 4:41am UTC](https://discuss.elastic.co/t/can-i-get-bucket-count-of-terms-aggregation/203561/1 "2019-10-15T04:41:32Z")

</div>

```
"aggs": {
        "terms_aggs": {
          "terms": {
            "field": "topic.keyword",
            "size": 10000
          }
        }
}

```

first, If I actually got 600 bucket count, can i get 600 in the query or aggs?  
second, Can i get that count if bucket count goes over 100,000? no limits?

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [October 18, 2019, 9:10am UTC](https://discuss.elastic.co/t/can-i-get-bucket-count-of-terms-aggregation/203561/2 "2019-10-18T09:10:04Z")

</div>

If you want to know how many unique topics you have the `cardinality` aggregation is probably the thing to look at

---

<div class="post-metadata">

**Author:** ![Yungyoung\_Ok](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yungyoung_ok/32/43465_2.png) [@Yungyoung\_Ok](https://discuss.elastic.co/u/Yungyoung_Ok)\
**Post date:** [October 21, 2019, 4:44am UTC](https://discuss.elastic.co/t/can-i-get-bucket-count-of-terms-aggregation/203561/3 "2019-10-21T04:44:36Z")

</div>

cardinality aggs does not produce the desired results.

please check this question...

> [@Can I access the field values in top hits aggs?](https://discuss.elastic.co/t/can-i-access-the-field-values-in-top-hits-aggs/202983):
>
> my data.... {"first\_seq":"aa", "second\_seq":1, "status":"LOADING"} {"first\_seq":"aa", "second\_seq":2, "status":"LOADING"} {"first\_seq":"aa", "second\_seq":3, "status":"LOADING"} {"first\_seq":"aa", "second\_seq":4, "status":"OK"} {"first\_seq":"bb", "second\_seq":10, "status":"LOADING"} {"first\_seq":"bb", "second\_seq":20, "status":"LOADING"} {"first\_seq":"bb", "second\_seq":30, "status":"LOADING"} {"first\_seq":"bb", "second\_seq":40, "status":"ERROR"} I only want to get {"first\_seq":"bb", "sec…

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [October 21, 2019, 2:47pm UTC](https://discuss.elastic.co/t/can-i-get-bucket-count-of-terms-aggregation/203561/4 "2019-10-21T14:47:40Z")

</div>

That looks like a different question.  
Maybe start with stating what business problem you’re trying to solve without the JSON.?

---

<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:** [November 18, 2019, 2:47pm UTC](https://discuss.elastic.co/t/can-i-get-bucket-count-of-terms-aggregation/203561/5 "2019-11-18T14:47:41Z")

</div>

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