# Elasticsearch 5.3, how to make keyword type not analyzed

**URL:** <https://discuss.elastic.co/t/elasticsearch-5-3-how-to-make-keyword-type-not-analyzed/98132>\
**Category:** Elasticsearch\
**Created:** [August 23, 2017, 9:12pm UTC](https://discuss.elastic.co/t/elasticsearch-5-3-how-to-make-keyword-type-not-analyzed/98132 "2017-08-23T21:12:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sharon.c](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sharon.c/32/16076_2.png) [@sharon.c](https://discuss.elastic.co/u/sharon.c)\
**Post date:** [August 23, 2017, 9:12pm UTC](https://discuss.elastic.co/t/elasticsearch-5-3-how-to-make-keyword-type-not-analyzed/98132/1 "2017-08-23T21:12:03Z")

</div>

I am using elasticsearch 5.3,

here is my definition of index template:

```
 PUT /_template/mytemplate
 {

    "template": "myindex_*",
    "order" : 1,
     "settings": {
         "number_of_shards" : 1,  
         "number_of_replicas" : 2
     },

    "mappings" : {
     "log" : {
     "_all" : {"enabled" : false, "omit_norms" : true},
     "_source" : {"enabled" : false },
       "properties" : { 
         "tags" : {
             "type" : "keyword"
         },
           "device_os" : {
             "type" : "keyword"
         },
...
   }
  }
 }

```

And I used logstash to inject data to this index...

Here is the index definition in Kibana , you can see for each field, it has 2 different types of fields,

1. tags.keyword and device\_os.keyword, which are not analysed,
2. tags and device\_os fields, which are analyzed

![image](https://us1.discourse-cdn.com/elastic/original/3X/8/6/86ae9c987d5dab18ab71d30a2a9fc91f1f0a7669.png)

How do I avoid generating the analysed fields? I only needs to aggregate them by the who string, and I do not need them to be broken down as token and analysed.  
The following is what I want:  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/5/85971ecead99c524354ff0b6159744c26d618907.png)

It is very strange, that when I was using elasticsearch 5.1, there are no additional analysed fields. When I change to elasticsearch 5.3, using the same template, the problem appears.

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [August 23, 2017, 9:23pm UTC](https://discuss.elastic.co/t/elasticsearch-5-3-how-to-make-keyword-type-not-analyzed/98132/2 "2017-08-23T21:23:54Z")

</div>

The only explanation I have is that the template was not actually applied.

---

<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 20, 2017, 9:24pm UTC](https://discuss.elastic.co/t/elasticsearch-5-3-how-to-make-keyword-type-not-analyzed/98132/3 "2017-09-20T21:24:04Z")

</div>

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