[DOCS] Update priority recommendation for index templates (#69006)

This commit is contained in:
James Rodewig 2021-02-16 10:53:28 -05:00 committed by GitHub
parent 6f02a9b088
commit 14ea0072e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 20 deletions

View file

@ -55,18 +55,18 @@ include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-v]
---- ----
GET _cat/templates/my-template-*?v=true&s=name GET _cat/templates/my-template-*?v=true&s=name
---- ----
// TEST[s/^/PUT _index_template\/my-template-0\n{"index_patterns": "te*", "priority": 200}\n/] // TEST[s/^/PUT _index_template\/my-template-0\n{"index_patterns": "te*", "priority": 500}\n/]
// TEST[s/^/PUT _index_template\/my-template-1\n{"index_patterns": "tea*", "priority": 201}\n/] // TEST[s/^/PUT _index_template\/my-template-1\n{"index_patterns": "tea*", "priority": 501}\n/]
// TEST[s/^/PUT _index_template\/my-template-2\n{"index_patterns": "teak*", "priority": 202, "version": 7}\n/] // TEST[s/^/PUT _index_template\/my-template-2\n{"index_patterns": "teak*", "priority": 502, "version": 7}\n/]
The API returns the following response: The API returns the following response:
[source,txt] [source,txt]
---- ----
name index_patterns order version composed_of name index_patterns order version composed_of
my-template-0 [te*] 200 [] my-template-0 [te*] 500 []
my-template-1 [tea*] 201 [] my-template-1 [tea*] 501 []
my-template-2 [teak*] 202 7 [] my-template-2 [teak*] 502 7 []
---- ----
// TESTRESPONSE[s/\*/\\*/ s/\[/\\[/ s/\]/\\]/ non_json] // TESTRESPONSE[s/\*/\\*/ s/\[/\\[/ s/\]/\\]/ non_json]

View file

@ -102,7 +102,7 @@ PUT /_index_template/my-data-stream-template
{ {
"index_patterns": [ "my-data-stream*" ], "index_patterns": [ "my-data-stream*" ],
"data_stream": { }, "data_stream": { },
"priority": 200, "priority": 500,
"template": { "template": {
"mappings": { "mappings": {
"properties": { "properties": {
@ -185,7 +185,7 @@ PUT /_index_template/my-data-stream-template
{ {
"index_patterns": [ "my-data-stream*" ], "index_patterns": [ "my-data-stream*" ],
"data_stream": { }, "data_stream": { },
"priority": 200, "priority": 500,
"template": { "template": {
"mappings": { "mappings": {
"properties": { "properties": {
@ -290,7 +290,7 @@ PUT /_index_template/my-data-stream-template
{ {
"index_patterns": [ "my-data-stream*" ], "index_patterns": [ "my-data-stream*" ],
"data_stream": { }, "data_stream": { },
"priority": 200, "priority": 500,
"template": { "template": {
"settings": { "settings": {
"index.refresh_interval": "30s" <1> "index.refresh_interval": "30s" <1>
@ -344,7 +344,7 @@ PUT /_index_template/my-data-stream-template
{ {
"index_patterns": [ "my-data-stream*" ], "index_patterns": [ "my-data-stream*" ],
"data_stream": { }, "data_stream": { },
"priority": 200, "priority": 500,
"template": { "template": {
"settings": { "settings": {
"sort.field": [ "@timestamp"], <1> "sort.field": [ "@timestamp"], <1>
@ -446,7 +446,7 @@ PUT /_index_template/new-data-stream-template
{ {
"index_patterns": [ "new-data-stream*" ], "index_patterns": [ "new-data-stream*" ],
"data_stream": { }, "data_stream": { },
"priority": 200, "priority": 500,
"template": { "template": {
"mappings": { "mappings": {
"properties": { "properties": {

View file

@ -139,7 +139,7 @@ PUT /_index_template/my-data-stream-template
{ {
"index_patterns": [ "my-data-stream*" ], "index_patterns": [ "my-data-stream*" ],
"data_stream": { }, "data_stream": { },
"priority": 200, "priority": 500,
"template": { "template": {
"settings": { "settings": {
"index.lifecycle.name": "my-data-stream-policy" "index.lifecycle.name": "my-data-stream-policy"

View file

@ -33,9 +33,12 @@ following index patterns:
// end::built-in-index-template-patterns[] // end::built-in-index-template-patterns[]
The {fleet-guide}/fleet-overview.html[{agent}] uses these templates to create The {fleet-guide}/fleet-overview.html[{agent}] uses these templates to create
data streams. If you use the {agent}, assign your index templates a priority data streams. Index templates created by {fleet} integrations use similar
lower than `100` to avoid overriding the built-in templates. Otherwise, to avoid overlapping index patterns and have a priority up to `200`.
accidentally applying the built-in templates, do one or more of the following:
If you use {fleet} or the {agent}, assign your index templates a priority
lower than `100` to avoid overriding these templates. Otherwise, to avoid
accidentally applying the templates, do one or more of the following:
- To disable all built-index index and component templates, set - To disable all built-index index and component templates, set
<<stack-templates-enabled,`stack.templates.enabled`>> to `false` using the <<stack-templates-enabled,`stack.templates.enabled`>> to `false` using the
@ -43,10 +46,11 @@ accidentally applying the built-in templates, do one or more of the following:
- Use a non-overlapping index pattern. - Use a non-overlapping index pattern.
- Assign templates with an overlapping pattern a `priority` higher than `100`. - Assign templates with an overlapping pattern a `priority` higher than `200`.
For example, if you don't use the {agent} and want to create a template for the For example, if you don't use {fleet} or the {agent} and want to create a
`logs-*` index pattern, assign your template a priority of `200`. This ensures template for the `logs-*` index pattern, assign your template a priority of
your template is applied instead of the built-in template for `logs-*-*`. `500`. This ensures your template is applied instead of the built-in template
for `logs-*-*`.
==== ====
// end::built-in-index-templates[] // end::built-in-index-templates[]
@ -110,7 +114,7 @@ PUT _index_template/template_1
"mydata": { } "mydata": { }
} }
}, },
"priority": 200, "priority": 500,
"composed_of": ["component_template1", "other_component_template"], "composed_of": ["component_template1", "other_component_template"],
"version": 3, "version": 3,
"_meta": { "_meta": {