Skip to content

Commit

Permalink
[DOCS] Re-add versioning to put template docs (#46384)
Browse files Browse the repository at this point in the history
Adds documentation for index template versioning
accidentally removed with #46297.
  • Loading branch information
jrodewig committed Sep 5, 2019
1 parent 2da295b commit 265812d
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions docs/reference/indices/templates.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down Expand Up @@ -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 <<indices-get-template, get index template>> API
with the <<common-options-response-filtering, `filter_path`>> 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

0 comments on commit 265812d

Please sign in to comment.