# Visualising field values as count metric in Kibana

**URL:** <https://discuss.elastic.co/t/visualising-field-values-as-count-metric-in-kibana/95103>\
**Category:** Kibana\
**Created:** [July 31, 2017, 1:24am UTC](https://discuss.elastic.co/t/visualising-field-values-as-count-metric-in-kibana/95103 "2017-07-31T01:24:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ravick](https://avatars.discourse-cdn.com/v4/letter/r/7feea3/32.png) [@ravick](https://discuss.elastic.co/u/ravick)\
**Post date:** [July 31, 2017, 1:24am UTC](https://discuss.elastic.co/t/visualising-field-values-as-count-metric-in-kibana/95103/1 "2017-07-31T01:24:46Z")

</div>

Hi All,

I have already imported json results of to my index and I would like to visualise and plot the json results to take the Count from the field "doc\_count":3467 and assign that to the respective country field. I had been having difficulty in plotting this data on a pit chart or vertical graph as the count metrics option only takes the number of times the specific field is seen in the logs. My requirement is to plot the count based on the value of the field. I am just stating with elastic search and kibana and any assistance on how this can be achieved is really helpful.

Example index values are below:

{"index": {"\_id": 1}}  
{"doc\_count":3467,"country":"AU"}  
{"index": {"\_id": 2}}  
{"doc\_count":345780,"country":"TW"}  
{"index": {"\_id": 3}}  
{"doc\_count":99786,"country":"KR"}  
{"index": {"\_id": 4}}  
{"doc\_count":2345,"country":"HK"}  
{"index": {"\_id": 5}}  
{"doc\_count":56432,"country":"IN"}  
{"index": {"\_id": 6}}  
{"doc\_count":9978654,"country":"CN"}

---

<div class="post-metadata">

**Author:** ![weltenwort](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/weltenwort/32/53885_2.png) [@weltenwort](https://discuss.elastic.co/u/weltenwort)\
**Post date:** [July 31, 2017, 12:18pm UTC](https://discuss.elastic.co/t/visualising-field-values-as-count-metric-in-kibana/95103/2 "2017-07-31T12:18:16Z")

</div>

Hi @ravick,

if I understand you correctly, you can achieve that with the following setup:

- start a new pie-, line- or bar-chart of the desired type for your index
- choose the `Max` aggregation over the field `doc_count` as the y-axis metric
- choose the `Terms` aggregation over the field `country` as the x-axis buckets
- adjust the bucket order and size to match your use-case

That could look like this:

![image](https://us1.discourse-cdn.com/elastic/original/3X/4/b/4bb6c8fa2c030407a082f0c5a6a4225fd5ef3cc8.png)

---

<div class="post-metadata">

**Author:** ![ravick](https://avatars.discourse-cdn.com/v4/letter/r/7feea3/32.png) [@ravick](https://discuss.elastic.co/u/ravick)\
**Post date:** [August 1, 2017, 1:30am UTC](https://discuss.elastic.co/t/visualising-field-values-as-count-metric-in-kibana/95103/3 "2017-08-01T01:30:26Z")

</div>

Hi @weltenwort,

That did the trick. Many thanks for your advice.  
I am able to plot the graph i was expecting.

---

<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:** [August 29, 2017, 1:30am UTC](https://discuss.elastic.co/t/visualising-field-values-as-count-metric-in-kibana/95103/4 "2017-08-29T01:30:40Z")

</div>

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