Skip to content

Commit ec3d9b6

Browse files
debadairjrodewig
andauthored
[DOCS] Clarify definition of max_size (#56561) (#56649)
* [DOCS] Extract the cron docs from Watcher docs and add to the API conventions. (#56313) * [DOCS] Promote cron expressions info from Watcher to a separate topic. * Fix table error * Fixed xref * Apply suggestions from code review Co-authored-by: James Rodewig <[email protected]> * Incorporated review feedback Co-authored-by: James Rodewig <[email protected]> * [DOCS] Clarify definition of max_size (#56561) Co-authored-by: James Rodewig <[email protected]>
1 parent 31b0f61 commit ec3d9b6

File tree

10 files changed

+252
-228
lines changed

10 files changed

+252
-228
lines changed

docs/reference/api-conventions.asciidoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ API, unless otherwise specified.
88

99
* <<multi-index>>
1010
* <<date-math-index-names>>
11+
* <<cron-expressions>>
1112
* <<common-options>>
1213
* <<url-access-control>>
1314

@@ -143,6 +144,8 @@ GET /%3Clogstash-%7Bnow%2Fd-2d%7D%3E%2C%3Clogstash-%7Bnow%2Fd-1d%7D%3E%2C%3Clogs
143144
// TEST[s/^/PUT logstash-2016.09.20\nPUT logstash-2016.09.19\nPUT logstash-2016.09.18\n/]
144145
// TEST[s/now/2016.09.20%7C%7C/]
145146

147+
include::rest-api/cron-expressions.asciidoc[]
148+
146149
[[common-options]]
147150
=== Common options
148151

docs/reference/commands/croneval.asciidoc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[[elasticsearch-croneval]]
44
== elasticsearch-croneval
55

6-
Validates and evaluates a cron expression.
6+
Validates and evaluates a <<cron-expressions,cron expression>>.
77

88
[discrete]
99
=== Synopsis
@@ -19,12 +19,11 @@ bin/elasticsearch-croneval <expression>
1919
=== Description
2020

2121
This command enables you to verify that your
22-
https://en.wikipedia.org/wiki/Cron[cron] expressions are valid for use with the
23-
{es} {alert-features} and produce the expected results.
22+
cron expressions are valid for use with
23+
{es} and produce the expected results.
2424

2525
This command is provided in the `$ES_HOME/bin` directory.
2626

27-
[discrete]
2827
=== Parameters
2928

3029
`-c, --count` <Integer>::
@@ -45,7 +44,7 @@ This command is provided in the `$ES_HOME/bin` directory.
4544
Shows verbose output.
4645

4746
[discrete]
48-
=== Examples
47+
=== Example
4948

5049
If the cron expression is valid, the following command displays the next
5150
20 times that the schedule will be triggered:

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,24 @@ PUT my_index-000001
4343
You must specify at least one rollover condition.
4444
An empty rollover action is invalid.
4545

46-
`max_size`::
47-
(Optional, <<byte-units, byte units>>)
48-
Triggers roll over after the specified maximum primary shard index storage size is reached.
46+
`max_age`::
47+
(Optional, <<time-units, time units>>)
48+
Triggers roll over after the maximum elapsed time from index creation is reached.
4949

5050
`max_docs`::
5151
(Optional, integer)
5252
Triggers roll over after the specified maximum number of documents is reached.
5353
Documents added since the last refresh are not included in the document count.
5454
The document count does *not* include documents in replica shards.
5555

56-
`max_age`::
57-
(Optional, <<time-units, time units>>)
58-
Triggers roll over after the maximum elapsed time from index creation is reached.
56+
`max_size`::
57+
(Optional, <<byte-units, byte units>>)
58+
Triggers roll over when the index reaches a certain size.
59+
This is the total size of all primary shards in the index.
60+
Replicas are not counted toward the maximum index size.
61+
+
62+
TIP: To see the current index size, use the <<cat-indices, _cat indices>> API.
63+
The `pri.store.size` value shows the combined size of all primary shards.
5964

6065
[[ilm-rollover-ex]]
6166
==== Example

docs/reference/ilm/using-policies-rollover.asciidoc

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,17 @@
44
== Configure rollover
55
[[using-policies-rollover]]
66
You control when the rollover action is triggered by specifying one or more
7-
rollover parameters. The rollover is performed once any of the criteria are
8-
met. Because the criteria are checked periodically, the index might grow
9-
slightly beyond the specified threshold. To control how often the criteria are
10-
checked, specify the `indices.lifecycle.poll_interval` cluster setting.
7+
rollover criteria:
8+
9+
* Maximum size (the combined size of all primary shards in the index)
10+
* Maximum document count
11+
* Maximum age
12+
13+
The rollover is performed once any of the criteria are met.
14+
Because the criteria are checked periodically, the index might grow
15+
slightly beyond the specified threshold.
16+
To control how often the criteria are checked,
17+
specify the `indices.lifecycle.poll_interval` cluster setting.
1118

1219
IMPORTANT: New indices created via rollover will not automatically inherit the
1320
policy used by the old index, and will not use any policy by default. Therefore,
@@ -16,24 +23,6 @@ it is highly recommended to apply the policy via
1623
setting, for your indices which specifies the policy you wish to use for each
1724
new index.
1825

19-
The rollover action takes the following parameters:
20-
21-
[[rollover-action-params]]
22-
.`rollover` Action Parameters
23-
[options="header"]
24-
|===
25-
|Name |Description
26-
|max_size |The maximum estimated size the primary shard of the index is allowed
27-
to grow to. Defaults to `null`. Optional.
28-
|max_docs |The maximum number of document the index should
29-
contain. Defaults to `null`. Optional.
30-
|max_age |The maximum age of the index. Defaults to `null`. Optional.
31-
|===
32-
33-
These parameters are used to determine when the index is considered "full" and
34-
a rollover should be performed. Where multiple criteria are defined the
35-
rollover operation will be performed once any of the criteria are met.
36-
3726
The following request defines a policy with a rollover action that triggers
3827
when the index size reaches 25GB. The old index is subsequently deleted after
3928
30 days.
@@ -127,7 +116,7 @@ the new index, enabling indexing to continue uninterrupted.
127116
[[skipping-rollover]]
128117
=== Skipping Rollover
129118

130-
The `index.lifecycle.indexing_complete` setting indicates to {ilm} whether this
119+
The `index.lifecycle.indexing_complete` setting indicates to {ilm-init} whether this
131120
index has already been rolled over. If it is set to `true`, that indicates that
132121
this index has already been rolled over and does not need to be rolled over
133122
again. Therefore, {ilm} will skip any Rollover Action configured in the

docs/reference/indices/rollover-index.asciidoc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,12 @@ The document count does *not* include documents in replica shards.
145145

146146
`max_size`::
147147
(Optional, <<byte-units, byte units>>)
148-
Maximum estimated size of the primary shard of the index.
148+
Maximum index size.
149+
This is the total size of all primary shards in the index.
150+
Replicas are not counted toward the maximum index size.
151+
152+
TIP: To see the current index size, use the <<cat-indices, _cat indices>> API.
153+
The `pri.store.size` value shows the combined size of all primary shards.
149154
--
150155

151156
include::{docdir}/rest-api/common-parms.asciidoc[tag=mappings]
Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
[[cron-expressions]]
2+
=== Cron expressions
3+
4+
A cron expression is a string of the following form:
5+
6+
[source,txt]
7+
------------------------------
8+
<seconds> <minutes> <hours> <day_of_month> <month> <day_of_week> [year]
9+
------------------------------
10+
11+
{es} uses the cron parser from the http://www.quartz-scheduler.org[Quartz Job Scheduler].
12+
For more information about writing Quartz cron expressions, see the
13+
http://www.quartz-scheduler.org/documentation/quartz-2.2.x/tutorials/tutorial-lesson-06.html[Quartz CronTrigger Tutorial].
14+
15+
All schedule times are in coordinated universal time (UTC); other timezones are not supported.
16+
17+
TIP: You can use the <<elasticsearch-croneval>> command line tool to validate your cron expressions.
18+
19+
20+
[[cron-elements]]
21+
==== Cron expression elements
22+
23+
All elements are required except for `year`.
24+
See <<cron-special-characters>> for information about the allowed special characters.
25+
26+
`<seconds>`::
27+
(Required)
28+
Valid values: `0`-`59` and the special characters `,` `-` `*` `/`
29+
30+
`<minutes>`::
31+
(Required)
32+
Valid values: `0`-`59` and the special characters `,` `-` `*` `/`
33+
34+
`<hours>`::
35+
(Required)
36+
Valid values: `0`-`23` and the special characters `,` `-` `*` `/`
37+
38+
`<day_of_month>`::
39+
(Required)
40+
Valid values: `1`-`31` and the special characters `,` `-` `*` `/` `?` `L` `W`
41+
42+
`<month>`::
43+
(Required)
44+
Valid values: `1`-`12`, `JAN`-`DEC`, `jan`-`dec`, and the special characters `,` `-` `*` `/`
45+
46+
`<day_of_week>`::
47+
(Required)
48+
Valid values: `1`-`7`, `SUN`-`SAT`, `sun`-`sat`, and the special characters `,` `-` `*` `/` `?` `L` `#`
49+
50+
`<year>`::
51+
(Optional)
52+
Valid values: `1970`-`2099` and the special characters `,` `-` `*` `/`
53+
54+
[[cron-special-characters]]
55+
==== Cron special characters
56+
57+
`*`::
58+
Selects every possible value for a field. For
59+
example, `*` in the `hours` field means "every hour".
60+
61+
`?`::
62+
No specific value. Use when you don't care what the value
63+
is. For example, if you want the schedule to trigger on a
64+
particular day of the month, but don't care what day of
65+
the week that happens to be, you can specify `?` in the
66+
`day_of_week` field.
67+
68+
`-`::
69+
A range of values (inclusive). Use to separate a minimum
70+
and maximum value. For example, if you want the schedule
71+
to trigger every hour between 9:00 a.m. and 5:00 p.m., you
72+
could specify `9-17` in the `hours` field.
73+
74+
`,`::
75+
Multiple values. Use to separate multiple values for a
76+
field. For example, if you want the schedule to trigger
77+
every Tuesday and Thursday, you could specify `TUE,THU`
78+
in the `day_of_week` field.
79+
80+
`/`::
81+
Increment. Use to separate values when specifying a time
82+
increment. The first value represents the starting point,
83+
and the second value represents the interval. For example,
84+
if you want the schedule to trigger every 20 minutes
85+
starting at the top of the hour, you could specify `0/20`
86+
in the `minutes` field. Similarly, specifying `1/5` in
87+
`day_of_month` field will trigger every 5 days starting on
88+
the first day of the month.
89+
90+
`L`::
91+
Last. Use in the `day_of_month` field to mean the last day
92+
of the month--day 31 for January, day 28 for February in
93+
non-leap years, day 30 for April, and so on. Use alone in
94+
the `day_of_week` field in place of `7` or `SAT`, or after
95+
a particular day of the week to select the last day of that
96+
type in the month. For example `6L` means the last Friday
97+
of the month. You can specify `LW` in the `day_of_month`
98+
field to specify the last weekday of the month. Avoid using
99+
the `L` option when specifying lists or ranges of values,
100+
as the results likely won't be what you expect.
101+
102+
`W`::
103+
Weekday. Use to specify the weekday (Monday-Friday) nearest
104+
the given day. As an example, if you specify `15W` in the
105+
`day_of_month` field and the 15th is a Saturday, the
106+
schedule will trigger on the 14th. If the 15th is a Sunday,
107+
the schedule will trigger on Monday the 16th. If the 15th
108+
is a Tuesday, the schedule will trigger on Tuesday the 15th.
109+
However if you specify `1W` as the value for `day_of_month`,
110+
and the 1st is a Saturday, the schedule will trigger on
111+
Monday the 3rd--it won't jump over the month boundary. You
112+
can specify `LW` in the `day_of_month` field to specify the
113+
last weekday of the month. You can only use the `W` option
114+
when the `day_of_month` is a single day--it is not valid
115+
when specifying a range or list of days.
116+
117+
`#`::
118+
Nth XXX day in a month. Use in the `day_of_week` field to
119+
specify the nth XXX day of the month. For example, if you
120+
specify `6#1`, the schedule will trigger on the first
121+
Friday of the month. Note that if you specify `3#5` and
122+
there are not 5 Tuesdays in a particular month, the
123+
schedule won't trigger that month.
124+
125+
[[cron-expression-examples]]
126+
==== Examples
127+
128+
[[cron-example-daily]]
129+
===== Setting daily triggers
130+
131+
`0 5 9 * * ?`::
132+
Trigger at 9:05 a.m. UTC every day.
133+
134+
`0 5 9 * * ? 2020`::
135+
Trigger at 9:05 a.m. UTC every day during the year 2020.
136+
137+
[[cron-example-range]]
138+
===== Restricting triggers to a range of days or times
139+
140+
`0 5 9 ? * MON-FRI`::
141+
Trigger at 9:05 a.m. UTC Monday through Friday.
142+
143+
`0 0-5 9 * * ?`::
144+
Trigger every minute starting at 9:00 a.m. UTC and ending at 9:05 a.m. UTC every day.
145+
146+
[[cron-example-interval]]
147+
===== Setting interval triggers
148+
149+
`0 0/15 9 * * ?`::
150+
Trigger every 15 minutes starting at 9:00 a.m. UTC and ending at 9:45 a.m. UTC every day.
151+
152+
`0 5 9 1/3 * ?`::
153+
Trigger at 9:05 a.m. UTC every 3 days every month, starting on the first day of the month.
154+
155+
[[cron-example-day]]
156+
===== Setting schedules that trigger on a particular day
157+
158+
`0 1 4 1 4 ?`::
159+
Trigger every April 1st at 4:01 a.m. UTC.
160+
`0 0,30 9 ? 4 WED`::
161+
Trigger at 9:00 a.m. UTC and at 9:30 a.m. UTC every Wednesday in the month of April.
162+
163+
`0 5 9 15 * ?`::
164+
Trigger at 9:05 a.m. UTC on the 15th day of every month.
165+
166+
`0 5 9 15W * ?`::
167+
Trigger at 9:05 a.m. UTC on the nearest weekday to the 15th of every month.
168+
169+
`0 5 9 ? * 6#1`::
170+
Trigger at 9:05 a.m. UTC on the first Friday of every month.
171+
172+
[[cron-example-last]]
173+
===== Setting triggers using last
174+
175+
`0 5 9 L * ?`::
176+
Trigger at 9:05 a.m. UTC on the last day of every month.
177+
178+
`0 5 9 ? * 2L`::
179+
Trigger at 9:05 a.m. UTC on the last Monday of every month.
180+
181+
`0 5 9 LW * ?`::
182+
Trigger at 9:05 a.m. UTC on the last weekday of every month.

docs/reference/slm/apis/slm-put.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Minimum number of snapshots to retain, even if the snapshots have expired.
107107
====
108108

109109
`schedule`::
110-
(Required, <<schedule-cron,Cron scheduler configuration>>)
110+
(Required, <<cron-expressions,Cron syntax>>)
111111
Periodic or absolute schedule at which the policy creates snapshots and deletes
112112
expired snapshots. Schedule changes to existing policies are applied immediately.
113113

docs/reference/slm/getting-started-slm.asciidoc

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ This is useful for taking snapshots before making a configuration change,
112112
upgrading, or to test a new policy.
113113
Manually executing a policy does not affect its configured schedule.
114114

115-
For example, the following request manually triggers the `nightly-snapshots` policy:
115+
Instead of waiting for the policy to run, tell {slm-init} to take a snapshot
116+
using the configuration right now instead of waiting for 1:30 a.m..
116117

117118
[source,console]
118119
--------------------------------------------------
@@ -159,19 +160,25 @@ repository is lost while copying files.
159160
"max_count": 50
160161
}
161162
},
162-
"last_success": {
163-
"snapshot_name": "nightly-snap-2019.04.24-tmtnyjtrsxkhbrrdcgg18a", <1>
164-
"time_string": "2019-04-24T16:43:49.316Z", <2>
163+
"last_success": { <1>
164+
"snapshot_name": "nightly-snap-2019.04.24-tmtnyjtrsxkhbrrdcgg18a", <2>
165+
"time_string": "2019-04-24T16:43:49.316Z",
165166
"time": 1556124229316
166167
} ,
167-
"next_execution": "2019-04-24T01:30:00.000Z", <3>
168-
"next_execution_millis": 1556048160000
168+
"last_failure": { <3>
169+
"snapshot_name": "nightly-snap-2019.04.02-lohisb5ith2n8hxacaq3mw",
170+
"time_string": "2019-04-02T01:30:00.000Z",
171+
"time": 1556042030000,
172+
"details": "{\"type\":\"index_not_found_exception\",\"reason\":\"no such index [important]\",\"resource.type\":\"index_or_alias\",\"resource.id\":\"important\",\"index_uuid\":\"_na_\",\"index\":\"important\",\"stack_trace\":\"[important] IndexNotFoundException[no such index [important]]\\n\\tat org.elasticsearch.cluster.metadata.IndexNameExpressionResolver$WildcardExpressionResolver.indexNotFoundException(IndexNameExpressionResolver.java:762)\\n\\tat org.elasticsearch.cluster.metadata.IndexNameExpressionResolver$WildcardExpressionResolver.innerResolve(IndexNameExpressionResolver.java:714)\\n\\tat org.elasticsearch.cluster.metadata.IndexNameExpressionResolver$WildcardExpressionResolver.resolve(IndexNameExpressionResolver.java:670)\\n\\tat org.elasticsearch.cluster.metadata.IndexNameExpressionResolver.concreteIndices(IndexNameExpressionResolver.java:163)\\n\\tat org.elasticsearch.cluster.metadata.IndexNameExpressionResolver.concreteIndexNames(IndexNameExpressionResolver.java:142)\\n\\tat org.elasticsearch.cluster.metadata.IndexNameExpressionResolver.concreteIndexNames(IndexNameExpressionResolver.java:102)\\n\\tat org.elasticsearch.snapshots.SnapshotsService$1.execute(SnapshotsService.java:280)\\n\\tat org.elasticsearch.cluster.ClusterStateUpdateTask.execute(ClusterStateUpdateTask.java:47)\\n\\tat org.elasticsearch.cluster.service.MasterService.executeTasks(MasterService.java:687)\\n\\tat org.elasticsearch.cluster.service.MasterService.calculateTaskOutputs(MasterService.java:310)\\n\\tat org.elasticsearch.cluster.service.MasterService.runTasks(MasterService.java:210)\\n\\tat org.elasticsearch.cluster.service.MasterService$Batcher.run(MasterService.java:142)\\n\\tat org.elasticsearch.cluster.service.TaskBatcher.runIfNotProcessed(TaskBatcher.java:150)\\n\\tat org.elasticsearch.cluster.service.TaskBatcher$BatchedTask.run(TaskBatcher.java:188)\\n\\tat org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:688)\\n\\tat org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:252)\\n\\tat org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:215)\\n\\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\\n\\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\\n\\tat java.base/java.lang.Thread.run(Thread.java:834)\\n\"}"
173+
} ,
174+
"next_execution": "2019-04-24T01:30:00.000Z", <4>
175+
"next_execution_millis": 1556048160000
169176
}
170177
}
171178
--------------------------------------------------
172179
// TESTRESPONSE[skip:the presence of last_failure and last_success is asynchronous and will be present for users, but is untestable]
173180

174-
<1> The name of the last snapshot that was succesfully initiated by the policy
175-
<2> When the snapshot was initiated
176-
<3> When the policy will initiate the next snapshot
177-
181+
<1> Information about the last time the policy successfully initated a snapshot
182+
<2> The name of the snapshot that was successfully initiated
183+
<3> Unformation about the last time the policy failed to initiate a snapshot
184+
<4> The next time the policy will execute

0 commit comments

Comments
 (0)