[DOCS] Update ILM docs to use composable index templates (#60323) (#60670)

This commit is contained in:
James Rodewig 2020-08-04 13:01:19 -04:00 committed by GitHub
parent b500b3d55a
commit 0587199fa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 61 additions and 52 deletions

View File

@ -294,7 +294,7 @@ as expected.
[discrete]
[[ilm-gs-alias-apply-policy]]
=== Create a legacy index template to apply the lifecycle policy
=== Create an index template to apply the lifecycle policy
To automatically apply a lifecycle policy to the new write index on rollover,
specify the policy in the index template used to create new indices.
@ -310,24 +310,26 @@ that match the index pattern.
when the rollover action is triggered for an index.
You can use the {kib} Create template wizard to add the template. To access the
wizard, open the menu, go to *Stack Management > Index Management*, and click
the *Index Templates* tab.
wizard, open the menu and go to *Stack Management > Index Management*. In the
the *Index Templates* tab, click *Create template*.
[role="screenshot"]
image:images/ilm/create-template-wizard.png[]
image:images/ilm/create-template-wizard.png[Create template page]
The create template request for the example template looks like this:
[source,console]
-----------------------
PUT _template/timeseries_template
PUT _index_template/timeseries_template
{
"index_patterns": ["timeseries-*"], <1>
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1,
"index.lifecycle.name": "timeseries_policy", <2>
"index.lifecycle.rollover_alias": "timeseries" <3>
"template": {
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1,
"index.lifecycle.name": "timeseries_policy", <2>
"index.lifecycle.rollover_alias": "timeseries" <3>
}
}
}
-----------------------
@ -342,7 +344,7 @@ Required for policies that use the rollover action.
[source,console]
--------------------------------------------------
DELETE /_template/timeseries_template
DELETE _index_template/timeseries_template
--------------------------------------------------
// TEST[continued]

View File

@ -98,28 +98,30 @@ to the document ID.
//////////////////////////
[source,console]
-----------------------
PUT _template/mylogs_template
PUT _index_template/mylogs_template
{
"index_patterns": [
"mylogs-*"
],
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1,
"index": {
"lifecycle": {
"name": "mylogs_condensed_policy", <2>
"rollover_alias": "mylogs" <3>
"template": {
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1,
"index": {
"lifecycle": {
"name": "mylogs_condensed_policy", <2>
"rollover_alias": "mylogs" <3>
}
}
}
},
"mappings": {
"properties": {
"message": {
"type": "text"
},
"@timestamp": {
"type": "date"
},
"mappings": {
"properties": {
"message": {
"type": "text"
},
"@timestamp": {
"type": "date"
}
}
}
}
@ -148,7 +150,7 @@ POST mylogs-pre-ilm-2019.06.25/_doc
[source,console]
--------------------------------------------------
DELETE _template/mylogs_template
DELETE _index_template/mylogs_template
--------------------------------------------------
// TEST[continued]

View File

@ -76,11 +76,12 @@ To use a policy that triggers the rollover action,
you need to configure the policy in the index template used to create each new index.
You specify the name of the policy and the alias used to reference the rolling indices.
To use the Create template wizard to create a template from {kib} Management,
go to Management, click **Index Management** and select the **Index Templates** view.
You can use the {kib} Create template wizard to create a template. To access the
wizard, open the menu and go to *Stack Management > Index Management*. In the
the *Index Templates* tab, click *Create template*.
[role="screenshot"]
image:images/ilm/create-template-wizard.png[]
image:images/ilm/create-template-wizard-my_template.png[Create template page]
The wizard invokes the <<indices-put-template,put template API>> to add templates to a cluster.
@ -89,14 +90,16 @@ The wizard invokes the <<indices-put-template,put template API>> to add template
====
[source,console]
-----------------------
PUT _template/my_template
PUT _index_template/my_template
{
"index_patterns": ["test-*"], <1>
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1,
"index.lifecycle.name": "my_policy", <2>
"index.lifecycle.rollover_alias": "test-alias" <3>
"template": {
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1,
"index.lifecycle.name": "my_policy", <2>
"index.lifecycle.rollover_alias": "test-alias" <3>
}
}
}
-----------------------
@ -109,7 +112,7 @@ PUT _template/my_template
[source,console]
--------------------------------------------------
DELETE /_template/my_template
DELETE _index_template/my_template
--------------------------------------------------
// TEST[continued]
@ -197,22 +200,24 @@ WARNING: Be careful that you don't inadvertently match indices that you don't wa
//////////////////////////
[source,console]
-----------------------
PUT _template/mylogs_template
PUT _index_template/mylogs_template
{
"index_patterns": [
"mylogs-*"
],
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1
},
"mappings": {
"properties": {
"message": {
"type": "text"
},
"@timestamp": {
"type": "date"
"template": {
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1
},
"mappings": {
"properties": {
"message": {
"type": "text"
},
"@timestamp": {
"type": "date"
}
}
}
}
@ -241,7 +246,7 @@ POST mylogs-pre-ilm-2019.06.25/_doc
[source,console]
--------------------------------------------------
DELETE _template/mylogs_template
DELETE _index_template/mylogs_template
--------------------------------------------------
// TEST[continued]

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 KiB

After

Width:  |  Height:  |  Size: 42 KiB