Histogram from Terms count

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.

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.


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.

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

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


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