4
4
5
5
Phases allowed: hot.
6
6
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.
8
9
9
10
IMPORTANT: If the rollover action is used on a <<ccr-put-follow,follower index>>,
10
11
policy execution waits until the leader index rolls over (or is
@@ -45,8 +46,11 @@ PUT my-index-000001
45
46
[[ilm-rollover-options]]
46
47
==== Options
47
48
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.
50
54
51
55
// tag::rollover-conditions[]
52
56
`max_age`::
@@ -90,6 +94,32 @@ replicas are ignored.
90
94
+
91
95
TIP: To see the current shard docs, use the <<cat-shards, _cat shards>> API.
92
96
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
+
93
123
// end::rollover-conditions[]
94
124
95
125
[[ilm-rollover-ex]]
@@ -109,7 +139,7 @@ PUT _ilm/policy/my_policy
109
139
"hot": {
110
140
"actions": {
111
141
"rollover" : {
112
- "max_primary_shard_size": "50GB "
142
+ "max_primary_shard_size": "50gb "
113
143
}
114
144
}
115
145
}
@@ -132,7 +162,7 @@ PUT _ilm/policy/my_policy
132
162
"hot": {
133
163
"actions": {
134
164
"rollover" : {
135
- "max_size": "100GB "
165
+ "max_size": "100gb "
136
166
}
137
167
}
138
168
}
@@ -214,8 +244,9 @@ PUT _ilm/policy/my_policy
214
244
===== Roll over using multiple conditions
215
245
216
246
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.
219
250
220
251
[source,console]
221
252
--------------------------------------------------
@@ -227,7 +258,35 @@ PUT _ilm/policy/my_policy
227
258
"actions": {
228
259
"rollover" : {
229
260
"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"
231
290
}
232
291
}
233
292
}
@@ -254,7 +313,7 @@ PUT /_ilm/policy/rollover_policy
254
313
"hot": {
255
314
"actions": {
256
315
"rollover": {
257
- "max_size": "50GB "
316
+ "max_size": "50gb "
258
317
}
259
318
}
260
319
},
0 commit comments