# How do I add doc\_values to logstash index mapping template in Elasticsearch?

**URL:** <https://discuss.elastic.co/t/how-do-i-add-doc-values-to-logstash-index-mapping-template-in-elasticsearch/25385>\
**Category:** Elasticsearch\
**Created:** [July 12, 2015, 10:59am UTC](https://discuss.elastic.co/t/how-do-i-add-doc-values-to-logstash-index-mapping-template-in-elasticsearch/25385 "2015-07-12T10:59:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dee/32/18876_2.png) [@Dee](https://discuss.elastic.co/u/Dee)\
**Post date:** [July 12, 2015, 10:59am UTC](https://discuss.elastic.co/t/how-do-i-add-doc-values-to-logstash-index-mapping-template-in-elasticsearch/25385/1 "2015-07-12T10:59:20Z")

</div>

This is the default logstash index mapping template I currently have in elasticsearch :

{  
"order" : 0,  
"template" : "logstash-_",  
"settings" : {  
"index.refresh\_interval" : "5s"  
},  
"mappings" : {  
"default" : {  
"dynamic\_templates" : [  
{  
"message\_field" : {  
"mapping" : {  
"index" : "analyzed",  
"omit\_norms" : true,  
"type" : "string"  
},  
"match\_mapping\_type" : "string",  
"match" : "message"  
}  
},  
{  
"string\_fields" : {  
"mapping" : {  
"index" : "analyzed",  
"omit\_norms" : true,  
"type" : "string",  
"fields" : {  
"raw" : {  
"index" : "not\_analyzed",  
"ignore\_above" : 256,  
"type" : "string"  
}  
}  
},  
"match\_mapping\_type" : "string",  
"match" : "_"  
}  
}  
],  
"properties" : {  
"geoip" : {  
"dynamic" : true,  
"path" : "full",  
"properties" : {  
"location" : {  
"type" : "geo\_point"  
}  
},  
"type" : "object"  
},  
"@version" : {  
"index" : "not\_analyzed",  
"type" : "string"  
}  
},  
"\_all" : {  
"enabled" : true  
}  
}  
},  
"aliases" : {  
}  
}  
Where am I suppose to add the doc\_values field ? I'm interested only in adding it to the template, not re-indexing old indices.

The documentation says that you can't add doc\_values to analyzed string fields.

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:** [July 12, 2015, 11:04am UTC](https://discuss.elastic.co/t/how-do-i-add-doc-values-to-logstash-index-mapping-template-in-elasticsearch/25385/2 "2015-07-12T11:04:37Z")

</div>

You'll want to add it to the .raw section.

```auto
"raw" : {
"index" : "not_analyzed",
"ignore_above" : 256,
"type" : "string",
"doc_values": true
}

```

---

<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 6, 2017, 12:02am UTC](https://discuss.elastic.co/t/how-do-i-add-doc-values-to-logstash-index-mapping-template-in-elasticsearch/25385/3 "2017-07-06T00:02:06Z")

</div>


