# Histogram from Terms count

**URL:** <https://discuss.elastic.co/t/histogram-from-terms-count/109908>\
**Category:** Kibana\
**Created:** [December 1, 2017, 10:09am UTC](https://discuss.elastic.co/t/histogram-from-terms-count/109908 "2017-12-01T10:09:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![strizr](https://avatars.discourse-cdn.com/v4/letter/s/a88e4f/32.png) [@strizr](https://discuss.elastic.co/u/strizr)\
**Post date:** [December 1, 2017, 10:09am UTC](https://discuss.elastic.co/t/histogram-from-terms-count/109908/1 "2017-12-01T10:09:21Z")

</div>

Hi,  
I am trying to create a simple histogram which would display count based on a count of terms - e.g., count(apples) = 5, count(pears)=5, count(bananas) = 4, so i'd like to have a histogram containing 5-bucket with value 2 and 4-bucket with value 1. I have 5 apple docs, 5 pear docs etc. I've been struggling to find a way to do this seemingly simple thing. Any help would be really appreciated.

---

<div class="post-metadata">

**Author:** ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)\
**Post date:** [December 1, 2017, 10:11pm UTC](https://discuss.elastic.co/t/histogram-from-terms-count/109908/2 "2017-12-01T22:11:22Z")

</div>

Hi Strizr,

I think you want a Terms aggregation on your fruit. In this example below I used `extension.raw` and I'm getting the metric of Count for each of the extensions.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/9/6/967e8327789146bd353d1aa98ab40864deefcdca.png)

Regards,  
Lee

---

<div class="post-metadata">

**Author:** ![strizr](https://avatars.discourse-cdn.com/v4/letter/s/a88e4f/32.png) [@strizr](https://discuss.elastic.co/u/strizr)\
**Post date:** [December 1, 2017, 10:55pm UTC](https://discuss.elastic.co/t/histogram-from-terms-count/109908/3 "2017-12-01T22:55:25Z")

</div>

Hi Lee,

thank you for your answer; however, I don't need simple Terms aggregation - in my fruit example I don't need columns for apple, pear and banana each. Instead, I need a column for fruits with the same count, i.e., I would like to have a count of all docs of the same fruit type as the Term, is that achievable?  
Sorry, i am not sure my initial post and the thread title made this clear enough.

---

<div class="post-metadata">

**Author:** ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)\
**Post date:** [December 2, 2017, 12:17am UTC](https://discuss.elastic.co/t/histogram-from-terms-count/109908/4 "2017-12-02T00:17:33Z")

</div>

Ah, I see. I'm trying to find a solution for that. I'm looking for something like a histogram pipeline aggregation but not finding that here; [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline.html)

I'll let you know if I come up with anything. Or maybe some brilliant Elastician will come along and provide a solution.

Regards,  
Lee

---

<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 30, 2017, 12:31am UTC](https://discuss.elastic.co/t/histogram-from-terms-count/109908/5 "2017-12-30T00:31:25Z")

</div>

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