diff --git a/docs/reference/indices/templates.asciidoc b/docs/reference/indices/templates.asciidoc index 191b2c8f9223..1c410a3d8fd9 100644 --- a/docs/reference/indices/templates.asciidoc +++ b/docs/reference/indices/templates.asciidoc @@ -115,6 +115,10 @@ include::{docdir}/rest-api/common-parms.asciidoc[tag=mappings] include::{docdir}/rest-api/common-parms.asciidoc[tag=settings] +`version`:: +(Optional, integer) +Version number used to manage index templates externally. +This number is not automatically generated by {es}. [[put-index-template-api-example]] @@ -197,3 +201,56 @@ order templates, with lower order templates providing the basis. NOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order. + + +[[versioning-templates]] +===== Template versioning + +You can use the `version` parameter +to add an optional version number to an index template. +External systems can use these version numbers +to simplify template management. + +The `version` parameter is completely optional +and not automatically generated by {es}. + +To unset a `version`, +replace the template without specifying one. + +[source,js] +-------------------------------------------------- +PUT /_template/template_1 +{ + "index_patterns" : ["*"], + "order" : 0, + "settings" : { + "number_of_shards" : 1 + }, + "version": 123 +} +-------------------------------------------------- +// CONSOLE + +To check the `version`, +you can use the <> API +with the <> query parameter +to return only the version number: + +[source,js] +-------------------------------------------------- +GET /_template/template_1?filter_path=*.version +-------------------------------------------------- +// CONSOLE +// TEST[continued] + +The API returns the following response: + +[source,js] +-------------------------------------------------- +{ + "template_1" : { + "version" : 123 + } +} +-------------------------------------------------- +// TESTRESPONSE