# Updating template to include DocValue via api

**URL:** <https://discuss.elastic.co/t/updating-template-to-include-docvalue-via-api/31659>\
**Category:** Logstash\
**Created:** [October 5, 2015, 7:57pm UTC](https://discuss.elastic.co/t/updating-template-to-include-docvalue-via-api/31659 "2015-10-05T19:57:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![lhorsky1](https://avatars.discourse-cdn.com/v4/letter/l/b2d939/32.png) [@lhorsky1](https://discuss.elastic.co/u/lhorsky1)\
**Post date:** [October 5, 2015, 7:57pm UTC](https://discuss.elastic.co/t/updating-template-to-include-docvalue-via-api/31659/1 "2015-10-05T19:57:54Z")

</div>

I want to add DocValue to my default logstash-\* template. I have seen documentation that says to add it to the raw section of the not\_analyzed. But I don't have a config file on the server, so I will need to add this using the api. I haven't found any code for editing the index via a put statement, so I don't know the syntax to use. Can someone please share the syntax for updating a template? I am using this to view the template:

http://[eshostname]😄 9200/\_template/logstash?pretty=true

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [October 5, 2015, 8:24pm UTC](https://discuss.elastic.co/t/updating-template-to-include-docvalue-via-api/31659/2 "2015-10-05T20:24:56Z")

</div>

The very first example in the index template documentation shows how to store an index template: [https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html)

Make sure you disable [`manage_template`](https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html#plugins-outputs-elasticsearch-manage_template) for your elasticsearch output.

---

<div class="post-metadata">

**Author:** ![lhorsky1](https://avatars.discourse-cdn.com/v4/letter/l/b2d939/32.png) [@lhorsky1](https://discuss.elastic.co/u/lhorsky1)\
**Post date:** [October 5, 2015, 10:55pm UTC](https://discuss.elastic.co/t/updating-template-to-include-docvalue-via-api/31659/3 "2015-10-05T22:55:18Z")

</div>

So, do I just add a new index template? Or are you saying that if I use the same index name with the XPUT command (using the syntax from the first example) that it overwrite the existing template?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [October 6, 2015, 3:46am UTC](https://discuss.elastic.co/t/updating-template-to-include-docvalue-via-api/31659/4 "2015-10-06T03:46:31Z")

</div>

Yes, if the index template name in the URL matches an already existing index template it'll get overwritten by your PUT operation.

---

<div class="post-metadata">

**Author:** ![lhorsky1](https://avatars.discourse-cdn.com/v4/letter/l/b2d939/32.png) [@lhorsky1](https://discuss.elastic.co/u/lhorsky1)\
**Post date:** [October 12, 2015, 5:13pm UTC](https://discuss.elastic.co/t/updating-template-to-include-docvalue-via-api/31659/5 "2015-10-12T17:13:40Z")

</div>

I was able to get my template updated, now I am wondering, how can I tell if docvalues are being applied to new indices. Is there a query I can run. Sorry if this a newbie question, but I can't find anything that shows how to tell if it is working or not. I want to make sure it is working correctly before I reindex the old data.

---

<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, 5:26am UTC](https://discuss.elastic.co/t/updating-template-to-include-docvalue-via-api/31659/6 "2017-07-06T05:26:50Z")

</div>

Closed on July 6, 2017, 5:26am UTC


