Skip to content

Commit

Permalink
[DOCS] Update priority recommendation for index templates (#69006) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jrodewig authored Feb 16, 2021
1 parent 1165a02 commit 202e32a
Showing 4 changed files with 24 additions and 20 deletions.
12 changes: 6 additions & 6 deletions docs/reference/cat/templates.asciidoc
Original file line number Diff line number Diff line change
@@ -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
----
// TEST[s/^/PUT _index_template\/my-template-0\n{"index_patterns": "te*", "priority": 200}\n/]
// TEST[s/^/PUT _index_template\/my-template-1\n{"index_patterns": "tea*", "priority": 201}\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-0\n{"index_patterns": "te*", "priority": 500}\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": 502, "version": 7}\n/]

The API returns the following response:

[source,txt]
----
name index_patterns order version composed_of
my-template-0 [te*] 200 []
my-template-1 [tea*] 201 []
my-template-2 [teak*] 202 7 []
my-template-0 [te*] 500 []
my-template-1 [tea*] 501 []
my-template-2 [teak*] 502 7 []
----
// TESTRESPONSE[s/\*/\\*/ s/\[/\\[/ s/\]/\\]/ non_json]

Original file line number Diff line number Diff line change
@@ -102,7 +102,7 @@ PUT /_index_template/my-data-stream-template
{
"index_patterns": [ "my-data-stream*" ],
"data_stream": { },
"priority": 200,
"priority": 500,
"template": {
"mappings": {
"properties": {
@@ -185,7 +185,7 @@ PUT /_index_template/my-data-stream-template
{
"index_patterns": [ "my-data-stream*" ],
"data_stream": { },
"priority": 200,
"priority": 500,
"template": {
"mappings": {
"properties": {
@@ -290,7 +290,7 @@ PUT /_index_template/my-data-stream-template
{
"index_patterns": [ "my-data-stream*" ],
"data_stream": { },
"priority": 200,
"priority": 500,
"template": {
"settings": {
"index.refresh_interval": "30s" <1>
@@ -344,7 +344,7 @@ PUT /_index_template/my-data-stream-template
{
"index_patterns": [ "my-data-stream*" ],
"data_stream": { },
"priority": 200,
"priority": 500,
"template": {
"settings": {
"sort.field": [ "@timestamp"], <1>
@@ -446,7 +446,7 @@ PUT /_index_template/new-data-stream-template
{
"index_patterns": [ "new-data-stream*" ],
"data_stream": { },
"priority": 200,
"priority": 500,
"template": {
"mappings": {
"properties": {
2 changes: 1 addition & 1 deletion docs/reference/data-streams/set-up-a-data-stream.asciidoc
Original file line number Diff line number Diff line change
@@ -139,7 +139,7 @@ PUT /_index_template/my-data-stream-template
{
"index_patterns": [ "my-data-stream*" ],
"data_stream": { },
"priority": 200,
"priority": 500,
"template": {
"settings": {
"index.lifecycle.name": "my-data-stream-policy"
20 changes: 12 additions & 8 deletions docs/reference/indices/index-templates.asciidoc
Original file line number Diff line number Diff line change
@@ -33,20 +33,24 @@ following index patterns:
// end::built-in-index-template-patterns[]
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
lower than `100` to avoid overriding the built-in templates. Otherwise, to avoid
accidentally applying the built-in templates, do one or more of the following:
data streams. Index templates created by {fleet} integrations use similar
overlapping index patterns and have a priority up to `200`.
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
<<stack-templates-enabled,`stack.templates.enabled`>> to `false` using the
<<cluster-update-settings,cluster update settings API>>.
- Use a non-overlapping index pattern.
- Assign templates with an overlapping pattern a `priority` higher than `100`.
For example, if you don't use the {agent} and want to create a template for the
`logs-*` index pattern, assign your template a priority of `200`. This ensures
your template is applied instead of the built-in template for `logs-*-*`.
- Assign templates with an overlapping pattern a `priority` higher than `200`.
For example, if you don't use {fleet} or the {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[]

@@ -107,7 +111,7 @@ PUT _index_template/template_1
"mydata": { }
}
},
"priority": 200,
"priority": 500,
"composed_of": ["component_template1", "other_component_template"],
"version": 3,
"_meta": {

0 comments on commit 202e32a

Please sign in to comment.