# How to get DocCount for all terms?

**URL:** https://discuss.elastic.co/t/how-to-get-doccount-for-all-terms/157856
**Category:** Elasticsearch
**Created:** [November 22, 2018, 10:26am UTC](https://discuss.elastic.co/t/how-to-get-doccount-for-all-terms/157856 "2018-11-22T10:26:31Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Xiaofei\_Sun](https://avatars.discourse-cdn.com/v4/letter/x/f0a364/32.png) [@Xiaofei\_Sun](https://discuss.elastic.co/u/Xiaofei_Sun)
#### Post date: [November 22, 2018, 10:26am UTC](https://discuss.elastic.co/t/how-to-get-doccount-for-all-terms/157856/1 "2018-11-22T10:26:31Z")

</div>

Hi everyone,

I really want to know how to get document count for all terms. That is, for every term, I want to know how many documents contain it.

I'm using term aggregation now but it seems that it's not a good idea because field data for text is not recommended.

Is there any clever way?

Best

---

<div class="post-metadata">

### Author: ![s1monw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/s1monw/32/3637_2.png) [@s1monw](https://discuss.elastic.co/u/s1monw)
#### Post date: [November 30, 2018, 10:28am UTC](https://discuss.elastic.co/t/how-to-get-doccount-for-all-terms/157856/2 "2018-11-30T10:28:34Z")

</div>

that's the only way to really do what you want IMO

---

<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 28, 2018, 10:28am UTC](https://discuss.elastic.co/t/how-to-get-doccount-for-all-terms/157856/3 "2018-12-28T10:28:35Z")

</div>

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