Browse Source

[DOCS] Reuse index template body params in simulate template API (#73177)

Changes:

* Reuses and reorders the index template API's body parameters in the simulate template API docs.
* Replaces several includes with a shorter xref.
* Reformats a sidebar on naming collisions with built-in index templates.
James Rodewig 4 years ago
parent
commit
cb943dbe9b

+ 3 - 4
docs/reference/api-conventions.asciidoc

@@ -57,10 +57,9 @@ For most APIs, wildcard expressions do not match hidden data streams and indices
 by default. To match hidden data streams and indices using a wildcard
 expression, you must specify the `expand_wildcards` query parameter.
 
-You can create hidden data streams by setting
-<<data-stream-hidden,`data_stream.hidden`>> to `true` in the stream's matching
-index template. You can hide indices using the <<index-hidden,`index.hidden`>>
-index setting.
+You can create hidden data streams by setting `data_stream.hidden` to `true` in
+the stream's matching <<indices-put-template,index template>>. You can hide
+indices using the <<index-hidden,`index.hidden`>> index setting.
 
 The backing indices for data streams are hidden automatically. Some features,
 such as {ml}, store information in hidden indices.

+ 2 - 1
docs/reference/docs/index_.asciidoc

@@ -203,7 +203,8 @@ If the target doesn't exist and doesn't match a data stream template,
 the operation automatically creates the index and applies any matching
 <<index-templates,index templates>>.
 
-include::{es-repo-dir}/indices/index-templates.asciidoc[tag=built-in-index-templates]
+NOTE: {es} includes several built-in index templates. To avoid naming collisions
+with these templates, see <<avoid-index-pattern-collisions>>.
 
 If no mapping exists, the index operation
 creates a dynamic mapping. By default, new fields and objects are

+ 0 - 5
docs/reference/indices/index-templates.asciidoc

@@ -34,9 +34,6 @@ template with the highest priority is used.
 [[avoid-index-pattern-collisions]]
 .Avoid index pattern collisions
 ****
-// tag::built-in-index-templates[]
-[IMPORTANT]
-====
 {es} has built-in index templates, each with a priority of `100`, for the
 following index patterns:
 
@@ -65,8 +62,6 @@ For example, if you don't use {fleet} or {agent} and want to create a template
 for the `logs-*` index pattern, assign your template a priority of `500`. This
 ensures your template is applied instead of the built-in template for
 `logs-*-*`.
-====
-// end::built-in-index-templates[]
 ****
 
 [discrete]

+ 28 - 26
docs/reference/indices/put-index-template.asciidoc

@@ -85,14 +85,14 @@ include::{docdir}/rest-api/common-parms.asciidoc[tag=master-timeout]
 [[put-index-template-api-request-body]]
 ==== {api-request-body-title}
 
-`index_patterns`::
-(Required, array of strings)
-Array of wildcard (`*`) expressions
-used to match the names of data streams and indices during creation.
-+
-include::{es-repo-dir}/indices/index-templates.asciidoc[tag=built-in-index-templates]
+`composed_of`::
+(Optional, array of strings)
+An ordered list of component template names. Component templates are merged in the order
+specified, meaning that the last component template specified has the highest precedence. See
+<<multiple-component-templates,Composing multiple component templates>> for an example.
 
-[xpack]#`data_stream`#::
+// tag::index-template-api-body[]
+`data_stream`::
 (Optional, object)
 If this object is included, the template is used to create data streams and
 their backing indices. Supports an empty object: `data_stream: { }`
@@ -103,12 +103,31 @@ See <<create-index-template,create an index template>>.
 .Properties of `data_stream`
 [%collapsible%open]
 ====
-[[data-stream-hidden]]
 `hidden`::
 (Optional, Boolean)
 If `true`, the data stream is <<hidden-indices,hidden>>. Defaults to `false`.
 ====
 
+`index_patterns`::
+(Required, array of strings)
+Array of wildcard (`*`) expressions
+used to match the names of data streams and indices during creation.
++
+{es} includes several built-in index templates. To avoid naming collisions with
+these templates, see <<avoid-index-pattern-collisions>>.
+
+`_meta`::
+(Optional, object)
+Optional user metadata about the index template. May have any contents.
+This map is not automatically generated by {es}.
+
+`priority`::
+(Optional, integer)
+Priority to determine index template precedence when a new data stream or index is created. The index template with
+the highest priority is chosen. If no priority is specified the template is treated as though it is
+of priority 0 (lowest priority).
+This number is not automatically generated by {es}.
+
 `template`::
 (Optional, object)
 Template to be applied. It may optionally include an `aliases`, `mappings`, or
@@ -126,28 +145,11 @@ include::{docdir}/rest-api/common-parms.asciidoc[tag=mappings]
 include::{docdir}/rest-api/common-parms.asciidoc[tag=settings]
 ====
 
-`composed_of`::
-(Optional, array of strings)
-An ordered list of component template names. Component templates are merged in the order
-specified, meaning that the last component template specified has the highest precedence. See
-<<multiple-component-templates,Composing multiple component templates>> for an example.
-
-`priority`::
-(Optional, integer)
-Priority to determine index template precedence when a new data stream or index is created. The index template with
-the highest priority is chosen. If no priority is specified the template is treated as though it is
-of priority 0 (lowest priority).
-This number is not automatically generated by {es}.
-
 `version`::
 (Optional, integer)
 Version number used to manage index templates externally.
 This number is not automatically generated by {es}.
-
-`_meta`::
-(Optional, object)
-Optional user metadata about the index template. May have any contents.
-This map is not automatically generated by {es}.
+// end::index-template-api-body[]
 
 [[put-index-template-api-example]]
 ==== {api-examples-title}

+ 2 - 41
docs/reference/indices/simulate-template.asciidoc

@@ -94,50 +94,11 @@ Defaults to `false`.
 
 include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=master-timeout]
 
+[role="child_attributes"]
 [[simulate-template-api-request-body]]
 ==== {api-request-body-title}
 
-`composed_of`::
-(Optional, array of strings)
-Ordered list of component template names. Component templates are merged in the order
-specified, meaning that the last component template specified has the highest precedence. 
-For an example, see 
-<<multiple-component-templates,Composing multiple component templates>>.
-
-`index_patterns`::
-(Required, array of strings)
-Array of wildcard (`*`) expressions
-used to match the names of indices during creation.
-
-`priority`::
-(Optional, integer)
-Priority that determines what template is applied if there are multiple templates 
-that match the name of a new index. 
-The highest priority template takes precedence. Defaults to `0` (lowest priority).
-
-`template`::
-(Optional, object)
-Template to apply.
-+
-.Properties of `template`
-[%collapsible%open]
-====
-include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=aliases]
-
-include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=mappings]
-
-include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=settings]
-====
-
-`version`::
-(Optional, integer)
-Version number used to manage index templates externally.
-This version is not automatically generated by {es}.
-
-`_meta`::
-(Optional, object)
-User-specified metadata for the index template. 
-This information is not generated or used by {es}.
+include::{es-ref-dir}/indices/put-index-template.asciidoc[tag=index-template-api-body]
 
 [role="child_attributes"]
 [[simulate-template-api-response-body]]