# How to make these fields agrregators?

**URL:** <https://discuss.elastic.co/t/how-to-make-these-fields-agrregators/215738>\
**Category:** Kibana\
**Created:** [January 20, 2020, 12:35pm UTC](https://discuss.elastic.co/t/how-to-make-these-fields-agrregators/215738 "2020-01-20T12:35:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![volcano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/volcano/32/46287_2.png) [@volcano](https://discuss.elastic.co/u/volcano)\
**Post date:** [January 20, 2020, 12:35pm UTC](https://discuss.elastic.co/t/how-to-make-these-fields-agrregators/215738/1 "2020-01-20T12:35:42Z")

</div>

This is the field list in my index pattern. How to make these fields aggregators?

 ![](https://us1.discourse-cdn.com/elastic/original/3X/2/1/21af3001f32ede402b018e26197ff22901cb9a49.png)

---

<div class="post-metadata">

**Author:** ![azasypkin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azasypkin/32/42216_2.png) [@azasypkin](https://discuss.elastic.co/u/azasypkin)\
**Post date:** [January 20, 2020, 2:04pm UTC](https://discuss.elastic.co/t/how-to-make-these-fields-agrregators/215738/2 "2020-01-20T14:04:01Z")

</div>

Hi @volcano,

Why do you need this? You cannot aggregate on `text` fields, that's why you have pairs of `keyword` fields that you're supposed to build your aggregations on. What I see at the screenshot looks normal and expected to me.

Best,  
Oleg

---

<div class="post-metadata">

**Author:** ![volcano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/volcano/32/46287_2.png) [@volcano](https://discuss.elastic.co/u/volcano)\
**Post date:** [January 20, 2020, 2:29pm UTC](https://discuss.elastic.co/t/how-to-make-these-fields-agrregators/215738/3 "2020-01-20T14:29:35Z")

</div>

> [@azasypkin](#):
>
> Why do you need this? You cannot aggregate on `text` fields, that's why you have pairs of `keyword` fields that you're supposed to build your aggregations on.

This is because I trying to plot a pie char in visualization and I dont see these `text` fields in aggregations \> terms \> field .

This is what I see :

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

Do you suggest to plot pie chart with the `keyword` fields then instead of `text` fields ? Is that correct ?

---

<div class="post-metadata">

**Author:** ![anjilinga](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anjilinga/32/86010_2.png) [@anjilinga](https://discuss.elastic.co/u/anjilinga)\
**Post date:** [January 20, 2020, 2:42pm UTC](https://discuss.elastic.co/t/how-to-make-these-fields-agrregators/215738/4 "2020-01-20T14:42:31Z")

</div>

Yes, both are same. string will store in text and keyword format.  
keyword format means if the text is having spaces it will store as different terms.  
if you want only text as format u need to update the mappings of index

---

<div class="post-metadata">

**Author:** ![azasypkin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azasypkin/32/42216_2.png) [@azasypkin](https://discuss.elastic.co/u/azasypkin)\
**Post date:** [January 20, 2020, 2:50pm UTC](https://discuss.elastic.co/t/how-to-make-these-fields-agrregators/215738/5 "2020-01-20T14:50:31Z")

</div>

> [@volcano](#):
>
> Do you suggest to plot pie chart with the `keyword` fields then instead of `text` fields ? Is that correct ?

Yes, that's correct, you should\can use only `*.keyword` versions of the string fields in aggregations. And if you don't use full text search for these fields you may change your mapping to have **only** keyword type, read more [here](https://www.elastic.co/guide/en/elasticsearch/reference/master/text.html).

Best,  
Oleg

---

<div class="post-metadata">

**Author:** ![volcano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/volcano/32/46287_2.png) [@volcano](https://discuss.elastic.co/u/volcano)\
**Post date:** [January 20, 2020, 2:51pm UTC](https://discuss.elastic.co/t/how-to-make-these-fields-agrregators/215738/6 "2020-01-20T14:51:54Z")

</div>

> [@azasypkin](#):
>
> Yes, that's correct, you should\can use only `*.keyword` versions of the string fields in aggregations.

I am okay with this.  
this is perfectly plotting the chart.  
Thanks a lot.

---

<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:** [February 17, 2020, 2:51pm UTC](https://discuss.elastic.co/t/how-to-make-these-fields-agrregators/215738/7 "2020-02-17T14:51:57Z")

</div>

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