# Type keyword in mapping but not able to aggregate on field kibana

**URL:** <https://discuss.elastic.co/t/type-keyword-in-mapping-but-not-able-to-aggregate-on-field-kibana/78331>\
**Category:** Kibana\
**Created:** [March 13, 2017, 12:07pm UTC](https://discuss.elastic.co/t/type-keyword-in-mapping-but-not-able-to-aggregate-on-field-kibana/78331 "2017-03-13T12:07:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ankush\_goswami](https://avatars.discourse-cdn.com/v4/letter/a/dc4da7/32.png) [@ankush\_goswami](https://discuss.elastic.co/u/ankush_goswami)\
**Post date:** [March 13, 2017, 12:07pm UTC](https://discuss.elastic.co/t/type-keyword-in-mapping-but-not-able-to-aggregate-on-field-kibana/78331/1 "2017-03-13T12:07:51Z")

</div>

Hi All,

I have updated mapping for my logs in Elasticsearch. Below is the mapping I have:-

```
      "beat" : {
        "properties" : {
          "hostname" : {
            "type" : "keyword"
          },
          "name" : {
            "type" : "keyword"
          },
          "version" : {
            "type" : "text",
            "index" : false,
            "norms" : false
          }
        }
      },

```

Now when I am trying to aggregate on [beat.name](http://beat.name) in kibana. i am not able to see the field in Visualization aside to this i am seeing another field beat.name.keyword which is not even defined in my mapping. How to correct this as far as I know defining type as keyword will make this field aggregatable.

But I am able to do aggregation in elasticsearch. Please find below.  
curl localhost:9200/userserver-logs-2017.03.11/\_search?pretty -d '{  
"query": {  
"match": {  
"[beat.name](http://beat.name)": "us-05"  
}  
},  
"sort": {  
"[beat.name](http://beat.name)": "asc"  
},  
"aggs": {  
"Name": {  
"terms": {  
"field": "[beat.name](http://beat.name)"  
}  
}  
}  
}'  
{  
"took" : 14,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 117853,  
"max\_score" : null

---

<div class="post-metadata">

**Author:** ![ankush\_goswami](https://avatars.discourse-cdn.com/v4/letter/a/dc4da7/32.png) [@ankush\_goswami](https://discuss.elastic.co/u/ankush_goswami)\
**Post date:** [March 13, 2017, 1:39pm UTC](https://discuss.elastic.co/t/type-keyword-in-mapping-but-not-able-to-aggregate-on-field-kibana/78331/2 "2017-03-13T13:39:33Z")

</div>

Guys I have fixed this issue as I can see somehow my mapping was wrong. Corrected the same and it started working \_field\_stats api helped me to debug this issue.

---

<div class="post-metadata">

**Author:** ![rashmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rashmi/32/16391_2.png) [@rashmi](https://discuss.elastic.co/u/rashmi)\
**Post date:** [March 15, 2017, 6:59pm UTC](https://discuss.elastic.co/t/type-keyword-in-mapping-but-not-able-to-aggregate-on-field-kibana/78331/3 "2017-03-15T18:59:51Z")

</div>

Hi Ankush,

Glad it worked after resolving the mapping issue. I will go ahead and close this ticket for now.

Thanks  
Rashmi

---

<div class="post-metadata">

**Author:** ![rashmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rashmi/32/16391_2.png) [@rashmi](https://discuss.elastic.co/u/rashmi)\
**Post date:** [March 15, 2017, 7:00pm UTC](https://discuss.elastic.co/t/type-keyword-in-mapping-but-not-able-to-aggregate-on-field-kibana/78331/4 "2017-03-15T19:00:01Z")

</div>


