Skip to content

[DOCS] Re-add versioning to put template docs #46384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 5, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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