period
editperiod
editThis filtertype will iterate over the actionable list and match indices or snapshots based on whether they fit within the given time range. They will remain in, or be removed from the actionable list based on the value of exclude.
- filtertype: period source: name range_from: -1 range_to: -1 timestring: '%Y.%m.%d' unit: weeks week_starts_on: sunday
Empty values and commented lines will result in the default value, if any, being selected. If a setting is set, but not used by a given filtertype, it may generate an error.
Periods, or Date Ranges
editFor the purposes of this filter, a unit can be one of hours
,
days
, weeks
, months
, or years
. Unless an epoch timestamp
is provided, reckoning will be centered on execution time. Reckoning is
truncated to the most recent whole unit. For example, if I selected hours
as
my unit
, and I began execution at 02:35, then the point of reckoning would be
02:00. This is relatively easy with days
, months
, and years
, but slightly
more complicated with weeks
. Some users may wish to reckon weeks by the ISO
standard, which starts weeks on Monday. Others may wish to use Sunday as the
first day of the week. Both are acceptable options with the period
filter.
The default behavior for weeks
is to have Sunday be the start of the week.
This can be overridden with week_starts_on as follows:
- filtertype: period source: name range_from: -1 range_to: -1 timestring: '%Y.%m.%d' unit: weeks week_starts_on: monday
range_from and range_to are counters of whole
units. A negative number indicates a whole unit in the past, while
a positive number indicates a whole unit in the future. A 0
indicates the
present unit. With such a timeline mentality, it is relatively easy to create
a date range that will meet your needs.
If the time of execution time is 2017-04-03T13:45:23.831, this table will help you figure out what the previous whole unit, current unit, and next whole unit will be, in ISO8601 format.
unit | -1 | 0 | +1 |
---|---|---|---|
hours |
2017-04-03T12:00:00 |
2017-04-03T13:00:00 |
2017-04-03T14:00:00 |
days |
2017-04-02T00:00:00 |
2017-04-03T00:00:00 |
2017-04-04T00:00:00 |
weeks sun |
2017-03-26T00:00:00 |
2017-04-02T00:00:00 |
2017-04-09T00:00:00 |
weeks mon |
2017-03-27T00:00:00 |
2017-04-03T00:00:00 |
2017-04-10T00:00:00 |
months |
2017-03-01T00:00:00 |
2017-04-01T00:00:00 |
2017-05-01T00:00:00 |
years |
2016-01-01T00:00:00 |
2017-01-01T00:00:00 |
2018-01-01T00:00:00 |
Ranges must be from older dates to newer dates, or smaller numbers (including negative numbers) to larger numbers or Curator will return an exception.
An example period
filter demonstrating how to select all daily indices by
timestring found in the index name from last month might look like this:
- filtertype: period source: name range_from: -1 range_to: -1 timestring: '%Y.%m.%d' unit: months
Having range_from
and range_to
both be the same value will mean that only
that whole unit will be selected, in this case, a month.
Required settings
editDependent settings
edit-
timestring (required if
source
isname
) -
field (required if
source
isfield_stats
) [Indices only] -
stats_result (only used if
source
isfield_stats
) [Indices only]
Optional settings
edit- epoch
-
exclude (default is
False
) - week_starts_on