# Creating a template and setting fields to 'not\_analyzed'

**URL:** <https://discuss.elastic.co/t/creating-a-template-and-setting-fields-to-not-analyzed/74448>\
**Category:** Elasticsearch\
**Created:** [February 8, 2017, 11:14pm UTC](https://discuss.elastic.co/t/creating-a-template-and-setting-fields-to-not-analyzed/74448 "2017-02-08T23:14:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maria\_Delarosa](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@Maria\_Delarosa](https://discuss.elastic.co/u/Maria_Delarosa)\
**Post date:** [February 8, 2017, 11:14pm UTC](https://discuss.elastic.co/t/creating-a-template-and-setting-fields-to-not-analyzed/74448/1 "2017-02-08T23:14:59Z")

</div>

I am able to succesfully create a template from `sense`. However, I am trying to set two fields `application` and `hostname` to `not_analyzed`. The below only works for one field e.g. `"match": "application"` or `"match": "hostname"`. However, I cant get them both set to `not_analyzed` by doing `"match": ["application", "hostname"]`. Any idea how I can set in the template both `application` and `hostname` to be `not_analyzed`?

```
PUT _template/mytemplates
{
    "order":0,
    "template":"mytemplates*",
    "settings":{
        "index.refresh_interval":"5s"
    },
    "mappings":{
        "logs":{
            "dynamic_templates":[
                { 
                  "my_string_fields":{
                      "match": ["application", "hostname"],
                      "match_mapping_type":"string",
                      "mapping":{
                          "type":"string",
                          "index":"not_analyzed",
                          "omit_norms" : true,
                          "norms":{
                              "enabled":false
                          }
                      }
                  }
                }
            ]
        }
    }
}
```

---

<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 8, 2017, 11:14pm UTC](https://discuss.elastic.co/t/creating-a-template-and-setting-fields-to-not-analyzed/74448/2 "2017-03-08T23:14:59Z")

</div>

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