You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are no details about the default ILM policy settings or index
template options in the Rollover tutorial, so I'm adding them as these
topics are relevant to explore. I'm also adding a link to the page about
viewing the lifecycle of an existing index or data stream into the
tutorial.
To match other ILM pages, I've added tabs for Kibana and API steps where
applicable.
Fixes#1562
When you continuously index timestamped documents into {{es}}, you typically use a [data stream](../../data-store/data-streams.md) so you can periodically [roll over](rollover.md) to a new index. This enables you to implement a [hot-warm-cold architecture](../data-tiers.md) to meet your performance requirements for your newest data, control costs over time, enforce retention policies, and still get the most out of your data.
12
+
When you continuously index timestamped documents into {{es}}, you typically use a [data stream](../../data-store/data-streams.md) so you can periodically [roll over](rollover.md) to a new index. This enables you to implement a [hot-warm-cold architecture](../data-tiers.md) to meet the performance requirements for your newest data, control costs over time, enforce retention policies, and still get the most out of your data.
13
13
14
14
To simplify index management and automate rollover, select one of the scenarios that best applies to your situation:
15
15
@@ -36,7 +36,7 @@ When you enable {{ilm}} for {{beats}} or the {{ls}} {{es}} output plugin, lifecy
36
36
37
37
A lifecycle policy specifies the phases in the index lifecycle and the actions to perform in each phase. A lifecycle can have up to five phases: `hot`, `warm`, `cold`, `frozen`, and `delete`.
38
38
39
-
For example, you might define a `timeseries_policy` that has two phases:
39
+
For example, you might define a policy named `timeseries_policy` that has the following two phases:
40
40
41
41
* A `hot` phase that defines a rollover action to specify that an index rolls over when it reaches either a `max_primary_shard_size` of 50 gigabytes or a `max_age` of 30 days.
42
42
* A `delete` phase that sets `min_age` to remove the index 90 days after rollover.
@@ -47,14 +47,24 @@ The `min_age` value is relative to the rollover time, not the index creation tim
47
47
::::
48
48
49
49
50
-
You can create the policy through {{kib}} or with the [create or update policy](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ilm-put-lifecycle) API. To create the policy from {{kib}}, open the menu and go to **Stack Management > Index Lifecycle Policies**. Click **Create policy**.
50
+
You can create the policy in {{kib}} or with the [create or update policy](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ilm-put-lifecycle) API.
51
+
52
+
::::{tab-set}
53
+
:group: kibana-api
54
+
:::{tab-item} {{kib}}
55
+
:sync: kibana
56
+
To create the policy from {{kib}}, open the menu and go to **Stack Management > Index Lifecycle Policies**. Click **Create policy**.
Use the [Create or update policy](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ilm-put-lifecycle) API to add an ILM policy to the {{es}} cluster:
56
67
57
-
::::{dropdown} API example
58
68
```console
59
69
PUT _ilm/policy/timeseries_policy
60
70
{
@@ -84,30 +94,45 @@ PUT _ilm/policy/timeseries_policy
84
94
3. Move the index into the `delete` phase 90 days after rollover.
85
95
4. Trigger the `delete` action when the index enters the delete phase.
86
96
87
-
97
+
:::
88
98
::::
89
99
100
+
:::{tip}
101
+
For more details about default {{ilm-init}} policy settings, refer to [Create a lifecycle policy](/manage-data/lifecycle/index-lifecycle-management/configure-lifecycle-policy.md#ilm-create-policy).
102
+
:::
90
103
91
104
92
105
### Create an index template to create the data stream and apply the lifecycle policy [ilm-gs-apply-policy]
93
106
94
107
To set up a data stream, first create an index template to specify the lifecycle policy. Because the template is for a data stream, it must also include a `data_stream` definition.
95
108
96
-
For example, you might create a `timeseries_template` to use for a future data stream named `timeseries`.
109
+
For example, you might create a template named `timeseries_template` and use it for a future data stream named `timeseries`.
110
+
111
+
To enable {{ilm-init}} to manage the data stream, the template configures one {{ilm-init}} setting:
112
+
113
+
*`index.lifecycle.name` specifies the name of the lifecycle policy that you want to apply to the data stream.
97
114
98
-
To enable the {{ilm-init}} to manage the data stream, the template configures one {{ilm-init}} setting:
115
+
Use the {{kib}} **Create template** wizard to add a template or the [Create or update index template](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-index-template) API to add a template and apply the lifecycle policy to indices matching the template.
99
116
100
-
*`index.lifecycle.name` specifies the name of the lifecycle policy to apply to the data stream.
117
+
::::{tab-set}
118
+
:group: kibana-api
119
+
:::{tab-item} {{kib}}
120
+
:sync: kibana
121
+
To add an index template to a cluster using the wizard, go to **Stack Management > Index Management**. In the **Index Templates** tab, click **Create template**.
101
122
102
-
You can use the {{kib}} Create template wizard to add the template. From Kibana, open the menu and go to **Stack Management > Index Management**. In the **Index Templates** tab, click **Create template**.
This wizard invokes the create or update index template API to create the index template with the options you specify.
126
+
127
+
:::{tip}
128
+
To learn about which index template options you can specify, refer to [Create an index template to apply the lifecycle policy](/manage-data/lifecycle/index-lifecycle-management/configure-lifecycle-policy.md#apply-policy-template).
129
+
:::
106
130
:::
107
131
108
-
This wizard invokes the [create or update index template API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-index-template) to create the index template with the options you specify.
132
+
:::{tab-item} API
133
+
:sync: api
134
+
Use the API to add an index template to your cluster:
109
135
110
-
::::{dropdown} API example
111
136
```console
112
137
PUT _index_template/timeseries_template
113
138
{
@@ -126,7 +151,7 @@ PUT _index_template/timeseries_template
126
151
1. Apply the template when a document is indexed into the `timeseries` target.
127
152
2. The name of the {{ilm-init}} policy used to manage the data stream.
128
153
129
-
154
+
:::
130
155
::::
131
156
132
157
@@ -155,7 +180,7 @@ This process repeats each time a rollover condition is met. You can search acros
To get status information for managed indices, you use the {{ilm-init}} explain API. This lets you find out things like:
183
+
Use {{kib}} to [view the current status of your managed indices](/manage-data/lifecycle/index-lifecycle-management/policy-view-status.md) and details about the ILM policy, or the {{ilm-init}} explain API. Find out things like:
159
184
160
185
* What phase an index is in and when it entered that phase.
161
186
* The current action and what step is being performed.
@@ -238,10 +263,21 @@ To enable automatic rollover, the template configures two {{ilm-init}} settings:
238
263
*`index.lifecycle.name` specifies the name of the lifecycle policy to apply to new indices that match the index pattern.
239
264
*`index.lifecycle.rollover_alias` specifies the index alias to be rolled over when the rollover action is triggered for an index.
240
265
241
-
You can use the {{kib}} Create template wizard to add the template. To access the wizard, open the menu and go to **Stack Management > Index Management**. In the **Index Templates** tab, click **Create template**.
266
+
::::{tab-set}
267
+
:group: kibana-api
268
+
:::{tab-item} {{kib}}
269
+
:sync: kibana
270
+
To use the {{kib}} **Create template** wizard to add the template, go to **Stack Management > Index Management**. In the **Index Templates** tab, click **Create template**.
For more information about the available index template options that you can specify, refer to [Create an index template to apply the lifecycle policy](/manage-data/lifecycle/index-lifecycle-management/configure-lifecycle-policy.md#apply-policy-template).
276
+
:::
277
+
:::
278
+
279
+
:::{tab-item} API
280
+
:sync: api
245
281
The create template request for the example template looks like this:
246
282
247
283
```console
@@ -263,7 +299,8 @@ PUT _index_template/timeseries_template
263
299
2. The name of the lifecycle policy to apply to each new index.
264
300
3. The name of the alias used to reference these indices. Required for policies that use the rollover action.
265
301
266
-
302
+
:::
303
+
::::
267
304
268
305
### Bootstrap the initial time series index with a write index alias [ilm-gs-alias-bootstrap]
269
306
@@ -421,6 +458,8 @@ Create a data stream using the [_data_stream API](https://www.elastic.co/docs/ap
421
458
PUT /_data_stream/movetods
422
459
```
423
460
461
+
You can [view the lifecycle status of your data stream](/manage-data/lifecycle/index-lifecycle-management/policy-view-status.md), including details about its associated ILM policy.
462
+
424
463
### Optional: Reindex your data with a data stream [manage-general-content-with-data-streams-reindex]
425
464
426
465
If you want to copy your documents from an existing index to the data stream you created, reindex with a data stream using the [_reindex API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-reindex):
0 commit comments