# Template error Elasticsearch 2.4.2

**URL:** https://discuss.elastic.co/t/template-error-elasticsearch-2-4-2/73893
**Category:** Elasticsearch
**Created:** [February 3, 2017, 5:27pm UTC](https://discuss.elastic.co/t/template-error-elasticsearch-2-4-2/73893 "2017-02-03T17:27:48Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![genesis](https://avatars.discourse-cdn.com/v4/letter/g/96bed5/32.png) [@genesis](https://discuss.elastic.co/u/genesis)
#### Post date: [February 3, 2017, 5:27pm UTC](https://discuss.elastic.co/t/template-error-elasticsearch-2-4-2/73893/1 "2017-02-03T17:27:48Z")

</div>

I have a new index and I am trying to create the corresponding index and I am getting the following error  
I am running Elasticsearch 2.4.2:

{"error":{"root\_cause":[{"type":"mapper\_parsing\_exception","reason":"Field [aud\_avs\_p] cannot be analyzed and have doc values"}],"type":"mapper\_parsing\_exception","reason":"Failed to parse mapping [logs]: Field [aud\_avs\_p] cannot be analyzed and have doc values","caused\_by":{"type":"mapper\_parsing\_exception","reason":"Field [aud\_avs\_p] cannot be analyzed and have doc values"}

curl -XPUT localhost:9200/\_template/mevents -d '  
{  
"template" : "mevents-\*",  
"settings" : {  
"index.mapper.dynamic" : "false",  
"index.number\_of\_replicas" : "1",  
"index.number\_of\_shards" : "5"  
},  
"mappings" : {  
"logs" : {  
"properties" : {  
"aud\_avs\_p" : {  
"type" : "string",  
"doc\_values" : "true"  
},  
"aud\_aops\_p" : {  
"type" : "long",  
"doc\_values" : "true"  
},  
"audience\_id" : {  
"index" : "not\_analyzed",  
"type" : "string",  
"doc\_values" : "true"  
}  
}  
}  
},  
"aliases" : { }  
}  
}'

---

<div class="post-metadata">

### Author: ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)
#### Post date: [February 3, 2017, 10:12pm UTC](https://discuss.elastic.co/t/template-error-elasticsearch-2-4-2/73893/2 "2017-02-03T22:12:08Z")

</div>

In 2.x, analyzed strings cannot also have doc values enabled. You'll have to either change that field to a `not_analyzed` string, or remove `doc_values`.

In 5.x, we introduce a distinction in how strings are specified with keyword / text. See: [https://www.elastic.co/guide/en/elasticsearch/reference/current/string.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/string.html) for more details

---

<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 3, 2017, 10:12pm UTC](https://discuss.elastic.co/t/template-error-elasticsearch-2-4-2/73893/3 "2017-03-03T22:12:16Z")

</div>

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