# ES Template versioning

**URL:** https://discuss.elastic.co/t/es-template-versioning/163962
**Category:** Elasticsearch
**Created:** [January 11, 2019, 11:14pm UTC](https://discuss.elastic.co/t/es-template-versioning/163962 "2019-01-11T23:14:08Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![oxygen300](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/oxygen300/32/39716_2.png) [@oxygen300](https://discuss.elastic.co/u/oxygen300)
#### Post date: [January 11, 2019, 11:14pm UTC](https://discuss.elastic.co/t/es-template-versioning/163962/1 "2019-01-11T23:14:08Z")

</div>

Hi Team,

I have a question about the use case of `version` field in the index templates.

[https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html#versioning-templates](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html#versioning-templates)

I have observed that I can put any version number, doesn't have to follow any pattern.  
As the doc also mentions, if we don't provide `version` while updating the template, the version is deleted.

So, my questions:

1. What is the exact use case for `version`?
2. Is there any way to retrieve a template by version number?

Thanks in advance!

---

<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 14, 2019, 1:49am UTC](https://discuss.elastic.co/t/es-template-versioning/163962/2 "2019-01-14T01:49:58Z")

</div>

Per the docs;

> The `version` field is completely optional and it is meant solely for external management of templates.

So it'd be useful if you had all your code in a repo and wanted to use that value as another indicator of what has been deployed.

> [@oxygen300](#):
>
> 1. Is there any way to retrieve a template by version number?

It doesn't store all the versions, just the latest.

---

<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: [February 11, 2019, 1:49am UTC](https://discuss.elastic.co/t/es-template-versioning/163962/3 "2019-02-11T01:49:59Z")

</div>

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