# I am confused with how keyword type work with aggregatable in Kibana

**URL:** <https://discuss.elastic.co/t/i-am-confused-with-how-keyword-type-work-with-aggregatable-in-kibana/120387>\
**Category:** Elasticsearch\
**Created:** [February 19, 2018, 2:32am UTC](https://discuss.elastic.co/t/i-am-confused-with-how-keyword-type-work-with-aggregatable-in-kibana/120387 "2018-02-19T02:32:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ian\_Huang](https://avatars.discourse-cdn.com/v4/letter/i/fbc32d/32.png) [@Ian\_Huang](https://discuss.elastic.co/u/Ian_Huang)\
**Post date:** [February 19, 2018, 2:32am UTC](https://discuss.elastic.co/t/i-am-confused-with-how-keyword-type-work-with-aggregatable-in-kibana/120387/1 "2018-02-19T02:32:01Z")

</div>

HI guys,

I am new to ELK stack. I am trying to understand how keyword type work with different setting. To test, I set following fields:

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

    }},    
    "OS2": { "type": "keyword",index: false }, 
    "OS3": { "type": "keyword",index: false,"ignore_above":256 }, 
    "OS4": { "type": "keyword",index: true,"ignore_above":256 }, 
    "tt": { "type": "keyword",index: true},    

```

From management console in Kabana, I can see all fields above are aggregatable.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/7/e78eddbdb5073a2aa0d7f2a0c8d521c4b4a856f6.png)

But only OS.keyword can return results as expected. The other fields always return zero results.

GET /logs3/visit3/\_search?pretty  
{  
"aggs":{  
"os2":{  
"terms":{  
"field": "OS2"  
}  
}  
}  
}

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/3/23a8b9bcb9bd13f072a2465b164f5a8d18bd46cf.png)

Can you help me to point what is correct way to set a non-indexed type but aggregatable field?

Possible values in fields are: Mac OS, IOS, Android....

---

<div class="post-metadata">

**Author:** ![Hanish\_Bansal](https://avatars.discourse-cdn.com/v4/letter/h/e36b37/32.png) [@Hanish\_Bansal](https://discuss.elastic.co/u/Hanish_Bansal)\
**Post date:** [February 19, 2018, 3:25am UTC](https://discuss.elastic.co/t/i-am-confused-with-how-keyword-type-work-with-aggregatable-in-kibana/120387/2 "2018-02-19T03:25:01Z")

</div>

If index is set to false then you would not be able to query on that field. Try running aggregation on OS4, it should give you results.  
For Aggregations, index should be true and type should be keyword.

---

<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:** [March 19, 2018, 3:25am UTC](https://discuss.elastic.co/t/i-am-confused-with-how-keyword-type-work-with-aggregatable-in-kibana/120387/3 "2018-03-19T03:25:02Z")

</div>

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