# Template has non analyzed field, but \_mapping doesn't show it

**URL:** https://discuss.elastic.co/t/template-has-non-analyzed-field-but--mapping-doesnt-show-it/88327
**Category:** Elasticsearch
**Created:** [June 5, 2017, 8:16pm UTC](https://discuss.elastic.co/t/template-has-non-analyzed-field-but--mapping-doesnt-show-it/88327 "2017-06-05T20:16:30Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![JonathanAaron](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jonathanaaron/32/24405_2.png) [@JonathanAaron](https://discuss.elastic.co/u/JonathanAaron)
#### Post date: [June 5, 2017, 8:16pm UTC](https://discuss.elastic.co/t/template-has-non-analyzed-field-but--mapping-doesnt-show-it/88327/1 "2017-06-05T20:16:30Z")

</div>

I'm trying to verify if a template is getting applied to my index. I have my template to set certain fields to be non-analyzed, but the \_mapping api doesn't show if it is or not.  
Here is my template when I do a GET \_tempate/sales\*

```
    {
        "sales_template": {
            "order": 0,
            "template": "sales_*",
            "settings": {
                "index": {
                    "number_of_shards": "5",
                    "number_of_replicas": "1"
                }
            },
            "mappings": {
                "sales": {
                    "_all": {
                        "enabled": false
                    },
                    "properties": {
                        "total_sale_amount": {
                            "type": "double"
                        },              
                        "location": {
                            "index": "not_analyzed",
                            "type": "text"
                        }
                    }
                }
            },
            "aliases": {}
        }
    }

```

GET sales\_20/\_mapping

```
{
    "sales_20": {
        "mappings": {
            "weekly_sales": {
                "_all": {
                    "enabled": false
                },
                "properties": {
                    "location": {
                        "type": "text"
                    },
                    "total_sale_amount": {
                        "type": "double"
                    }
									}
            }
        }
    }
}

```

I feel that when I get the mapping for the index it should say the location is non\_analyzed.

---

<div class="post-metadata">

### Author: ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)
#### Post date: [June 9, 2017, 12:43pm UTC](https://discuss.elastic.co/t/template-has-non-analyzed-field-but--mapping-doesnt-show-it/88327/2 "2017-06-09T12:43:32Z")

</div>

@JonathanAaron you need to show us what you've done, otherwise we can't help

---

<div class="post-metadata">

### Author: ![JonathanAaron](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jonathanaaron/32/24405_2.png) [@JonathanAaron](https://discuss.elastic.co/u/JonathanAaron)
#### Post date: [June 9, 2017, 3:33pm UTC](https://discuss.elastic.co/t/template-has-non-analyzed-field-but--mapping-doesnt-show-it/88327/3 "2017-06-09T15:33:07Z")

</div>

Thanks Clinton, I just updated my question with some of the results I was getting.

---

<div class="post-metadata">

### Author: ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)
#### Post date: [June 12, 2017, 10:09am UTC](https://discuss.elastic.co/t/template-has-non-analyzed-field-but--mapping-doesnt-show-it/88327/4 "2017-06-12T10:09:24Z")

</div>

Hi @JonathanAaron

analyzed/not\_analyzed is only relevant to the old `string` fields. `text` fields are all analyzed. `keyword` fields are not analyzed.

i'm surprised that you didn't get an exception when that field was created, but it is probably some of the bwc layer between string/text/keyword that ended up just ignoring the not\_analyzed.

summary: use `keyword` instead of `text` for that field

---

<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: [July 10, 2017, 10:09am UTC](https://discuss.elastic.co/t/template-has-non-analyzed-field-but--mapping-doesnt-show-it/88327/5 "2017-07-10T10:09:27Z")

</div>

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