# Making text field aggregatable in kibana using elasticsearch

**URL:** <https://discuss.elastic.co/t/making-text-field-aggregatable-in-kibana-using-elasticsearch/98257>\
**Category:** Elasticsearch\
**Created:** [August 24, 2017, 3:18pm UTC](https://discuss.elastic.co/t/making-text-field-aggregatable-in-kibana-using-elasticsearch/98257 "2017-08-24T15:18:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Singa\_Forever](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@Singa\_Forever](https://discuss.elastic.co/u/Singa_Forever)\
**Post date:** [August 24, 2017, 3:18pm UTC](https://discuss.elastic.co/t/making-text-field-aggregatable-in-kibana-using-elasticsearch/98257/1 "2017-08-24T15:18:50Z")

</div>

Hello,

This is my first time using elk 5.5 for gathering tweets from twitter, everything is ok and works fine.  
In order to handle my application, I need to make the filed text (tweets ) as an aggregatable field, i tried to add raw field to text but nothing happened.

> "properties": {  
> "text": {  
> "type" : "keyword","index": "not\_analyzed",  
> "fields" : {  
> "raw" : {"type": "text", "index" : "not\_analyzed"}  
> }  
> },

This is the json template that I'm using

> Blockquote  
> {  
> "template": "twitter",  
> "order": 1,  
> "settings": {  
> "number\_of\_shards": 3  
> },  
> "mappings": {  
> "tweet": {  
> "\_all": {  
> "enabled": true  
> },  
> "dynamic\_templates" : [ {  
> "message\_field" : {  
> "match" : "message",  
> "match\_mapping\_type" : "text",  
> "mapping" : {  
> "type" : "text", "index" : "not\_analyzed",  
> "fields" : {  
> "raw" : {"type": "text", "index" : "not\_analyzed"}  
> }  
> }  
> }  
> }, {  
> "text\_fields" : {  
> "match" : "\*",  
> "match\_mapping\_type" : "text",  
> "mapping" : {  
> "type" : "text", "index" : "not\_analyzed", "omit\_norms" : true,  
> "fields" : {  
> "raw" : {"type": "text", "index" : "not\_analyzed", "ignore\_above" : 256}  
> }  
> }  
> }  
> } ],  
> "properties": {  
> "text": {  
> "type" : "keyword","index": "not\_analyzed",  
> "fields" : {  
> "raw" : {"type": "text", "index" : "not\_analyzed"}  
> }  
> },  
> "created\_at": {  
> "index": "not\_analyzed",  
> "type": "date",  
> "format": "EEE MMM dd HH:mm:ss Z yyyy",  
> "locale": "US"  
> },  
> "user": {  
> "properties": {  
> "created\_at": {  
> "index": "not\_analyzed",  
> "type": "date",  
> "format": "EEE MMM dd HH:mm:ss Z yyyy",  
> "locale": "US"  
> },  
> "screen\_name": {  
> "index": "not\_analyzed",  
> "type": "text"  
> },  
> "type": {  
> "type": "text"  
> }  
> }  
> },  
> "coordinates": {  
> "properties": {  
> "coordinates": {  
> "type": "geo\_point"  
> },  
> "type": {  
> "type": "text"  
> }  
> }  
> }  
> }  
> }  
> }  
> }

waiting for your help,  
Thank you

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [September 1, 2017, 9:09am UTC](https://discuss.elastic.co/t/making-text-field-aggregatable-in-kibana-using-elasticsearch/98257/2 "2017-09-01T09:09:13Z")

</div>

Use type "keyword" and drop the "index not analyzed" part on your "raw" fields.  
However, I'd question the logic behind wanting to do this as this will introduce many largish fields into your index.  
What business problem are you trying to solve here?

---

<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:** [September 29, 2017, 9:09am UTC](https://discuss.elastic.co/t/making-text-field-aggregatable-in-kibana-using-elasticsearch/98257/3 "2017-09-29T09:09:28Z")

</div>

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