Skip to content

Commit a3e7603

Browse files
authored
[8.4] Rollover min_* conditions docs and highlight (#89434) (#89436)
1 parent d4e83af commit a3e7603

File tree

4 files changed

+107
-14
lines changed

4 files changed

+107
-14
lines changed

docs/changelog/83345.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,33 @@ summary: Add min_* conditions to rollover
33
area: ILM+SLM
44
type: enhancement
55
issues: []
6+
highlight:
7+
title: Minimum conditions for the rollover API and ILM actions
8+
body: |-
9+
The rollover API and ILM actions now support minimum conditions for rollover.
10+
11+
Minimum conditions prevent rollover from occuring until they are met. That is, an index
12+
will rollover once one or more max conditions are satisfied and all min conditions are satisfied.
13+
14+
As an example, the following ILM policy would roll an index over if it is at least 7 days old or
15+
at least 100 gigabytes, but only as long as the index is not empty.
16+
17+
```
18+
PUT _ilm/policy/my_policy
19+
{
20+
"policy": {
21+
"phases": {
22+
"hot": {
23+
"actions": {
24+
"rollover" : {
25+
"max_age": "7d",
26+
"max_size": "100gb",
27+
"min_docs": 1
28+
}
29+
}
30+
}
31+
}
32+
}
33+
}
34+
```
35+
notable: true

docs/reference/ilm/actions/ilm-rollover.asciidoc

Lines changed: 68 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
Phases allowed: hot.
66

7-
Rolls over a target to a new index when the existing index meets one or more of the rollover conditions.
7+
Rolls over a target to a new index when the existing index satisfies
8+
the specified rollover conditions.
89

910
IMPORTANT: If the rollover action is used on a <<ccr-put-follow,follower index>>,
1011
policy execution waits until the leader index rolls over (or is
@@ -45,8 +46,11 @@ PUT my-index-000001
4546
[[ilm-rollover-options]]
4647
==== Options
4748

48-
You must specify at least one rollover condition.
49-
An empty rollover action is invalid.
49+
A rollover action must specify at least one max_* condition, it may include zero
50+
or more min_* conditions. An empty rollover action is invalid.
51+
52+
The index will rollover once any max_* condition is satisfied and all
53+
min_* conditions are satisfied.
5054

5155
// tag::rollover-conditions[]
5256
`max_age`::
@@ -90,6 +94,32 @@ replicas are ignored.
9094
+
9195
TIP: To see the current shard docs, use the <<cat-shards, _cat shards>> API.
9296
The `docs` value shows the number of documents each shard.
97+
98+
`min_age`::
99+
(Optional, <<time-units, time units>>)
100+
Prevents rollover until after the minimum elapsed time from index creation is reached.
101+
See notes on `max_age`.
102+
103+
`min_docs`::
104+
(Optional, integer)
105+
Prevents rollover until after the specified minimum number of documents is reached.
106+
See notes on `max_docs`.
107+
108+
`min_size`::
109+
(Optional, <<byte-units, byte units>>)
110+
Prevents rollover until the index reaches a certain size.
111+
See notes on `max_size`.
112+
113+
`min_primary_shard_size`::
114+
(Optional, <<byte-units, byte units>>)
115+
Prevents rollover until the largest primary shard in the index reaches a certain size.
116+
See notes on `max_primary_shard_size`.
117+
118+
`min_primary_shard_docs`::
119+
(Optional, integer)
120+
Prevents rollover until the largest primary shard in the index reaches a certain number of documents.
121+
See notes on `max_primary_shard_docs`.
122+
93123
// end::rollover-conditions[]
94124

95125
[[ilm-rollover-ex]]
@@ -109,7 +139,7 @@ PUT _ilm/policy/my_policy
109139
"hot": {
110140
"actions": {
111141
"rollover" : {
112-
"max_primary_shard_size": "50GB"
142+
"max_primary_shard_size": "50gb"
113143
}
114144
}
115145
}
@@ -132,7 +162,7 @@ PUT _ilm/policy/my_policy
132162
"hot": {
133163
"actions": {
134164
"rollover" : {
135-
"max_size": "100GB"
165+
"max_size": "100gb"
136166
}
137167
}
138168
}
@@ -214,8 +244,9 @@ PUT _ilm/policy/my_policy
214244
===== Roll over using multiple conditions
215245

216246
When you specify multiple rollover conditions,
217-
the index is rolled over when _any_ of the conditions are met.
218-
This example rolls the index over if it is at least 7 days old or at least 100 gigabytes.
247+
the index is rolled over when _any_ of the max_* and _all_ of the min_* conditions are met.
248+
This example rolls the index over if it is at least 7 days old or at least 100 gigabytes,
249+
but only as long as the index is not empty.
219250

220251
[source,console]
221252
--------------------------------------------------
@@ -227,7 +258,35 @@ PUT _ilm/policy/my_policy
227258
"actions": {
228259
"rollover" : {
229260
"max_age": "7d",
230-
"max_size": "100GB"
261+
"max_size": "100gb",
262+
"min_docs": 1
263+
}
264+
}
265+
}
266+
}
267+
}
268+
}
269+
--------------------------------------------------
270+
271+
[ilm-rollover-conditions-ex]]
272+
===== Roll over while maintaining shard sizes
273+
274+
This example rolls the index over when the primary shard size is at least 50gb,
275+
or when the index is at least 30 days old, but only as long as a primary shard is at least 1gb.
276+
For low-volume indices, this prevents the creation of many small shards.
277+
278+
[source,console]
279+
--------------------------------------------------
280+
PUT _ilm/policy/my_policy
281+
{
282+
"policy": {
283+
"phases": {
284+
"hot": {
285+
"actions": {
286+
"rollover" : {
287+
"max_primary_shard_size": "50gb",
288+
"max_age": "30d",
289+
"min_primary_shard_size": "1gb"
231290
}
232291
}
233292
}
@@ -254,7 +313,7 @@ PUT /_ilm/policy/rollover_policy
254313
"hot": {
255314
"actions": {
256315
"rollover": {
257-
"max_size": "50GB"
316+
"max_size": "50gb"
258317
}
259318
}
260319
},

docs/reference/ilm/index-rollover.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ On each rollover, the new index becomes the write index.
4343
=== Automatic rollover
4444

4545
{ilm-init} enables you to automatically roll over to a new index based
46-
on the index size, document count, or age. When a rollover is triggered, a new
46+
on conditions like the index size, document count, or age. When a rollover is triggered, a new
4747
index is created, the write alias is updated to point to the new index, and all
4848
subsequent updates are written to the new index.
4949

docs/reference/indices/rollover-index.asciidoc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ include::{es-repo-dir}/indices/create-index.asciidoc[tag=index-name-reqs]
111111

112112
`dry_run`::
113113
(Optional, Boolean)
114-
If `true`, checks whether the current index matches one or more specified
114+
If `true`, checks whether the current index satisfies the specified
115115
`conditions` but does not perform a rollover. Defaults to `false`.
116116

117117
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=wait_for_active_shards]
@@ -132,10 +132,14 @@ include::{es-repo-dir}/indices/create-index.asciidoc[tag=aliases-props]
132132
`conditions`::
133133
(Optional, object)
134134
Conditions for the rollover. If specified, {es} only performs the rollover if
135-
the current index meets one or more of these conditions. If this parameter is
135+
the current index satisfies these conditions. If this parameter is
136136
not specified, {es} performs the rollover unconditionally.
137137
+
138-
IMPORTANT: To trigger a rollover, the current index must meet these conditions
138+
If conditions are specified, at least one of them must be a max_* condition.
139+
The index will rollover if any max_* condition is satisfied and all
140+
min_* conditions are satisfied.
141+
+
142+
IMPORTANT: To trigger a rollover, the current index must satisfy these conditions
139143
at the time of the request. {es} does not monitor the index after the API
140144
response. To automate rollover, use {ilm-init}'s <<ilm-rollover,`rollover`>>
141145
instead.
@@ -197,7 +201,7 @@ conditions were specified, this is an empty object.
197201
====
198202
`<condition>`::
199203
(Boolean) The key is each condition. The value is its result. If `true`, the
200-
index met the condition at rollover.
204+
index met the condition.
201205
====
202206

203207
[[rollover-index-api-example]]

0 commit comments

Comments
 (0)