Browse Source

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

Adds documentation for index template versioning
accidentally removed with #46297.
James Rodewig 6 years ago
parent
commit
b336fbe38a
1 changed files with 57 additions and 0 deletions
  1. 57 0
      docs/reference/indices/templates.asciidoc

+ 57 - 0
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 <<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