|
@@ -32,6 +32,15 @@ PUT _template/template_1
|
|
|
--------------------------------------------------
|
|
|
// TESTSETUP
|
|
|
|
|
|
+//////////////////////////
|
|
|
+
|
|
|
+[source,console]
|
|
|
+--------------------------------------------------
|
|
|
+DELETE _template/template_1
|
|
|
+--------------------------------------------------
|
|
|
+// TEARDOWN
|
|
|
+
|
|
|
+//////////////////////////
|
|
|
|
|
|
[[put-index-template-api-request]]
|
|
|
==== {api-request-title}
|
|
@@ -62,7 +71,7 @@ You can use C-style /* */ block comments in index templates.
|
|
|
You can include comments anywhere in the request body,
|
|
|
except before the opening curly bracket.
|
|
|
|
|
|
-[[getting]]
|
|
|
+[[getting]]
|
|
|
===== Getting templates
|
|
|
|
|
|
See <<indices-get-template>>.
|
|
@@ -194,12 +203,12 @@ Note, for mappings, the merging is "deep", meaning that specific
|
|
|
object/property based mappings can easily be added/overridden on higher
|
|
|
order templates, with lower order templates providing the basis.
|
|
|
|
|
|
-NOTE: Multiple matching templates with the same order value will
|
|
|
+NOTE: Multiple matching templates with the same order value will
|
|
|
result in a non-deterministic merging order.
|
|
|
|
|
|
|
|
|
[[versioning-templates]]
|
|
|
-===== Template versioning
|
|
|
+===== Template versioning
|
|
|
|
|
|
You can use the `version` parameter
|
|
|
to add an optional version number to an index template.
|
|
@@ -210,39 +219,39 @@ The `version` parameter is completely optional
|
|
|
and not automatically generated by {es}.
|
|
|
|
|
|
To unset a `version`,
|
|
|
-replace the template without specifying one.
|
|
|
+replace the template without specifying one.
|
|
|
|
|
|
[source,console]
|
|
|
---------------------------------------------------
|
|
|
-PUT /_template/template_1
|
|
|
-{
|
|
|
- "index_patterns" : ["*"],
|
|
|
- "order" : 0,
|
|
|
- "settings" : {
|
|
|
- "number_of_shards" : 1
|
|
|
- },
|
|
|
- "version": 123
|
|
|
-}
|
|
|
---------------------------------------------------
|
|
|
+--------------------------------------------------
|
|
|
+PUT /_template/template_1
|
|
|
+{
|
|
|
+ "index_patterns" : ["*"],
|
|
|
+ "order" : 0,
|
|
|
+ "settings" : {
|
|
|
+ "number_of_shards" : 1
|
|
|
+ },
|
|
|
+ "version": 123
|
|
|
+}
|
|
|
+--------------------------------------------------
|
|
|
|
|
|
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:
|
|
|
+to return only the version number:
|
|
|
|
|
|
[source,console]
|
|
|
---------------------------------------------------
|
|
|
-GET /_template/template_1?filter_path=*.version
|
|
|
---------------------------------------------------
|
|
|
-// TEST[continued]
|
|
|
+--------------------------------------------------
|
|
|
+GET /_template/template_1?filter_path=*.version
|
|
|
+--------------------------------------------------
|
|
|
+// TEST[continued]
|
|
|
|
|
|
The API returns the following response:
|
|
|
|
|
|
[source,console-result]
|
|
|
---------------------------------------------------
|
|
|
-{
|
|
|
- "template_1" : {
|
|
|
- "version" : 123
|
|
|
- }
|
|
|
-}
|
|
|
---------------------------------------------------
|
|
|
+--------------------------------------------------
|
|
|
+{
|
|
|
+ "template_1" : {
|
|
|
+ "version" : 123
|
|
|
+ }
|
|
|
+}
|
|
|
+--------------------------------------------------
|