# Mapping text field with keyword not aggregatable

**URL:** <https://discuss.elastic.co/t/mapping-text-field-with-keyword-not-aggregatable/68583>\
**Category:** Elasticsearch\
**Created:** [December 9, 2016, 3:12pm UTC](https://discuss.elastic.co/t/mapping-text-field-with-keyword-not-aggregatable/68583 "2016-12-09T15:12:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pjanzen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pjanzen/32/13756_2.png) [@pjanzen](https://discuss.elastic.co/u/pjanzen)\
**Post date:** [December 9, 2016, 3:12pm UTC](https://discuss.elastic.co/t/mapping-text-field-with-keyword-not-aggregatable/68583/1 "2016-12-09T15:12:36Z")

</div>

Hi,

I create a mapping like this

```
    "login": {
      "type": "text",
      "fields": {
       "keyword": {
         "type": "keyword",
         "ignore_above" : 256
       }
     }
    },

```

([here is the full mapping](https://gist.github.com/pjanzen/df8510d175751647fda285cef4ab0e95))

If I follow the docs from here [https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html)  
I should end up with a aggregatable field but it doesnt.. I have refreshed my fields in kibana but helaas that did not help.

I am running the lastest version of ELK 5.0.1.

I hope someone can help.

Thanks.  
Paul.

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [December 9, 2016, 3:27pm UTC](https://discuss.elastic.co/t/mapping-text-field-with-keyword-not-aggregatable/68583/2 "2016-12-09T15:27:04Z")

</div>

You ought to have a field called `login.keyword` that is aggregatable. At least, in Elasticsearch you should be able to run aggregations on that field.

---

<div class="post-metadata">

**Author:** ![pjanzen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pjanzen/32/13756_2.png) [@pjanzen](https://discuss.elastic.co/u/pjanzen)\
**Post date:** [December 9, 2016, 3:30pm UTC](https://discuss.elastic.co/t/mapping-text-field-with-keyword-not-aggregatable/68583/3 "2016-12-09T15:30:46Z")

</div>

Agreed, but if I have that field in elasticsearch kibana should see it as aggregatable I would expect.  
It creates such a field in my dynamic mapping and those are perfectly aggregatable.

It could be that it is not a ES problem but a kibana problem, who knows....

Al other ideas are welcome...

Paul.

---

<div class="post-metadata">

**Author:** ![Rudolf\_Reddy\_Macejka](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rudolf_reddy_macejka/32/12875_2.png) [@Rudolf\_Reddy\_Macejka](https://discuss.elastic.co/u/Rudolf_Reddy_Macejka)\
**Post date:** [January 4, 2017, 1:43pm UTC](https://discuss.elastic.co/t/mapping-text-field-with-keyword-not-aggregatable/68583/4 "2017-01-04T13:43:37Z")

</div>

Hello,

i have similar problem.

if i want to aggregate by a .keyword field in main **\_source** tree, all is working fine.  
But if I have .keyword field in deeper sructure there I am not able to aggregate thta. Still getting empty result:

> ...  
> "queues": { "terms": { "field": "otherAttributes.queName.keyword" } }  
> ...

Any idea why it is not able to aggregate the hierarchy?

Thank you!  
Reddy

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [January 4, 2017, 5:26pm UTC](https://discuss.elastic.co/t/mapping-text-field-with-keyword-not-aggregatable/68583/5 "2017-01-04T17:26:27Z")

</div>

Nope! It ought to work. Could you try to reproduce the issue with `curl`? That helps remove lots of variables from things like this.

Also, you might want to start a new topic for it.

---

<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 1, 2017, 5:26pm UTC](https://discuss.elastic.co/t/mapping-text-field-with-keyword-not-aggregatable/68583/6 "2017-02-01T17:26:42Z")

</div>

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