# Apply grouping in visualization

**URL:** https://discuss.elastic.co/t/apply-grouping-in-visualization/142870
**Category:** Kibana
**Created:** [August 3, 2018, 8:29am UTC](https://discuss.elastic.co/t/apply-grouping-in-visualization/142870 "2018-08-03T08:29:30Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![bahare\_hoseini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bahare_hoseini/32/46907_2.png) [@bahare\_hoseini](https://discuss.elastic.co/u/bahare_hoseini)
#### Post date: [August 3, 2018, 8:29am UTC](https://discuss.elastic.co/t/apply-grouping-in-visualization/142870/1 "2018-08-03T08:29:31Z")

</div>

i need to visualize 2 dependent fields in one diagram such that the following simple scenario is fulfilled:  
for every message in response, field "f1" is unique but field "f2" could be repetitive. Then the goal is to display the average value of "f1" per "f2". IOW, i'm looking for a way to group "f1" based on "f2".

how is that possible in kibana?

---

<div class="post-metadata">

### Author: ![Larry\_Gregory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/larry_gregory/32/34969_2.png) [@Larry\_Gregory](https://discuss.elastic.co/u/Larry_Gregory)
#### Post date: [August 3, 2018, 11:24am UTC](https://discuss.elastic.co/t/apply-grouping-in-visualization/142870/2 "2018-08-03T11:24:17Z")

</div>

Hi @bahare_hoseini ,

Sounds like you're looking for the [Average Aggregation](https://www.elastic.co/guide/en/elasticsearch/reference/6.3/search-aggregations-metrics-avg-aggregation.html). Here's an example of the Data Table visualization showing an average of "f2" for each unique "f1":

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/0/50e8e8c832f76ad3e962acbe23b017156eb887db.png)

---

<div class="post-metadata">

### Author: ![bahare\_hoseini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bahare_hoseini/32/46907_2.png) [@bahare\_hoseini](https://discuss.elastic.co/u/bahare_hoseini)
#### Post date: [August 3, 2018, 12:31pm UTC](https://discuss.elastic.co/t/apply-grouping-in-visualization/142870/3 "2018-08-03T12:31:03Z")

</div>

@Larry_Gregory tnx a lot.  
My only question is that what type of fields could be included in the first combobox, where u selected f2. As I can't see my own f2 and some other fields in the combobox.

---

<div class="post-metadata">

### Author: ![Larry\_Gregory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/larry_gregory/32/34969_2.png) [@Larry\_Gregory](https://discuss.elastic.co/u/Larry_Gregory)
#### Post date: [August 3, 2018, 12:34pm UTC](https://discuss.elastic.co/t/apply-grouping-in-visualization/142870/4 "2018-08-03T12:34:34Z")

</div>

You'll only be able to take an average against a [numeric](https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html) field. If you inspect your index mapping, it will tell you which data type each field is indexed as.

---

<div class="post-metadata">

### Author: ![bahare\_hoseini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bahare_hoseini/32/46907_2.png) [@bahare\_hoseini](https://discuss.elastic.co/u/bahare_hoseini)
#### Post date: [August 3, 2018, 12:43pm UTC](https://discuss.elastic.co/t/apply-grouping-in-visualization/142870/5 "2018-08-03T12:43:39Z")

</div>

Thank u.  
I tried to extract my desired field by "[dissect](https://www.elastic.co/guide/en/logstash/current/plugins-filters-dissect.html)" plugin. Do i need to mention the type (which is number) of dissected field somewhere?

---

<div class="post-metadata">

### Author: ![Larry\_Gregory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/larry_gregory/32/34969_2.png) [@Larry\_Gregory](https://discuss.elastic.co/u/Larry_Gregory)
#### Post date: [August 3, 2018, 12:47pm UTC](https://discuss.elastic.co/t/apply-grouping-in-visualization/142870/6 "2018-08-03T12:47:59Z")

</div>

Taking a quick glance at the docs, it looks like you can tell dissect how to convert the fields into your desired data type: [https://www.elastic.co/guide/en/logstash/current/plugins-filters-dissect.html#plugins-filters-dissect-convert\_datatype](https://www.elastic.co/guide/en/logstash/current/plugins-filters-dissect.html#plugins-filters-dissect-convert_datatype)

For more help with dissect, I'd recommend asking in the Logstash topic

---

<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 31, 2018, 12:48pm UTC](https://discuss.elastic.co/t/apply-grouping-in-visualization/142870/7 "2018-08-31T12:48:04Z")

</div>

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