# Elasticsearch template doesnt set doc\_value attribute for index mappings

**URL:** https://discuss.elastic.co/t/elasticsearch-template-doesnt-set-doc-value-attribute-for-index-mappings/39916
**Category:** Elasticsearch
**Created:** [January 22, 2016, 6:52pm UTC](https://discuss.elastic.co/t/elasticsearch-template-doesnt-set-doc-value-attribute-for-index-mappings/39916 "2016-01-22T18:52:44Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Rahul](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@Rahul](https://discuss.elastic.co/u/Rahul)
#### Post date: [January 22, 2016, 6:52pm UTC](https://discuss.elastic.co/t/elasticsearch-template-doesnt-set-doc-value-attribute-for-index-mappings/39916/1 "2016-01-22T18:52:44Z")

</div>

Hi,

Based on certain suggestion for elastic search performance tunning, we started using doc\_value as true for several fields in our index mapping. This attribute appears in index mappings when we create the index with mappings separately. However when we use the same mapping template, the index creation does not set the doc value attribute as per the template in the mappings. Does doc\_value attribute needs to be set in different manner while using templates?

Thanks.

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [January 24, 2016, 4:06am UTC](https://discuss.elastic.co/t/elasticsearch-template-doesnt-set-doc-value-attribute-for-index-mappings/39916/2 "2016-01-24T04:06:42Z")

</div>

What version are you on?

---

<div class="post-metadata">

### Author: ![Rahul](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@Rahul](https://discuss.elastic.co/u/Rahul)
#### Post date: [January 25, 2016, 4:15pm UTC](https://discuss.elastic.co/t/elasticsearch-template-doesnt-set-doc-value-attribute-for-index-mappings/39916/3 "2016-01-25T16:15:11Z")

</div>

Its 2.1.1 version.

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [January 25, 2016, 10:49pm UTC](https://discuss.elastic.co/t/elasticsearch-template-doesnt-set-doc-value-attribute-for-index-mappings/39916/4 "2016-01-25T22:49:19Z")

</div>

2.X automatically does doc\_values for non\_analyzed fields.  
There's a flag you can pass the mapping API to get these included when you query it, but I can't find it at the moment.

---

<div class="post-metadata">

### Author: ![Rahul](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@Rahul](https://discuss.elastic.co/u/Rahul)
#### Post date: [January 26, 2016, 3:08pm UTC](https://discuss.elastic.co/t/elasticsearch-template-doesnt-set-doc-value-attribute-for-index-mappings/39916/5 "2016-01-26T15:08:13Z")

</div>

Thanks Mark. That really helps.

---

<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 5, 2017, 11:21pm UTC](https://discuss.elastic.co/t/elasticsearch-template-doesnt-set-doc-value-attribute-for-index-mappings/39916/6 "2017-07-05T23:21:24Z")

</div>


