# Visualizing multi-valued field in kibana using terms aggregation

**URL:** <https://discuss.elastic.co/t/visualizing-multi-valued-field-in-kibana-using-terms-aggregation/153710>\
**Category:** Kibana\
**Created:** [October 24, 2018, 5:07am UTC](https://discuss.elastic.co/t/visualizing-multi-valued-field-in-kibana-using-terms-aggregation/153710 "2018-10-24T05:07:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sam5](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@sam5](https://discuss.elastic.co/u/sam5)\
**Post date:** [October 24, 2018, 5:07am UTC](https://discuss.elastic.co/t/visualizing-multi-valued-field-in-kibana-using-terms-aggregation/153710/1 "2018-10-24T05:07:04Z")

</div>

Hi,

I have multi-valued key "tags" as below.  
{  
"\_source": {  
"tags": "["aaa" , "bbb", "ccc"]",  
"message": {  
"test1": "asdasd",  
"test2": "ddddd",  
}  
}

I need to visualize the above multi-valued key in kibana to see how many documents have each of these tags. I am trying to use "terms" Aggregation to visualize this multi-valued field with no success as "tags" appear as a single string "["aaa" , "bbb", "ccc"]" and not separately as "aaa" "bbb" and "ccc". I also tried using nested mapping for the "tags" with no success.  
From my litle knowledge of ELK stack I understand I should be defining some type for "tags" but not sure which to use which will help me use "terms" aggregation for tags. Only other option I see is using mutiple key value pairs like tag1=aaa, tag2=bbb and so on, but that is not really helpful in my situation

Your help is much appreciated. Thanks

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [October 24, 2018, 12:38pm UTC](https://discuss.elastic.co/t/visualizing-multi-valued-field-in-kibana-using-terms-aggregation/153710/2 "2018-10-24T12:38:37Z")

</div>

you could merge the tags field to a string, make that field analysed by Elastic, then you will be able to do a terms aggregation on the tags field and it will show values for each tag.

---

<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:** [November 21, 2018, 12:38pm UTC](https://discuss.elastic.co/t/visualizing-multi-valued-field-in-kibana-using-terms-aggregation/153710/3 "2018-11-21T12:38:38Z")

</div>

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