space
editspace
edit- filtertype: space disk_space: 100 reverse: True use_age: False source: creation_date timestring: field: stats_result: exclude: False
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.
This filtertype will iterate over the actionable list and match indices when their cumulative disk consumption exceeds disk_space gigabytes. They are first ordered by age, or by alphabet, so as to guarantee the oldest indices are deleted first. They will remain in, or be removed from the actionable list based on the value of exclude.
Deleting Indices By Space
editThis filtertype is for those who want to retain indices based on disk consumption, rather than by a set number of days. There are some important caveats regarding this choice:
- Elasticsearch cannot calculate the size of closed indices. Elasticsearch does not keep tabs on how much disk-space closed indices consume. If you close indices, your space calculations will be inaccurate.
- Indices consume resources just by existing. You could run into performance and/or operational snags in Elasticsearch as the count of indices climbs.
- You need to manually calculate how much space across all nodes. The total you give will be the sum of all space consumed across all nodes in your cluster. If you use shard allocation to put more shards or indices on a single node, it will not affect the total space reported by the cluster, but you may still run out of space on that node.
These are only a few of the caveats. This is still a valid use-case, especially for those running a single-node test box.
For use cases, where "like" indices are being counted, and their name pattern
guarantees date sorting is equal to alphabetical sorting, it is unnecessary to
set use_age to True
, as index names will be sorted in
reverse order by default. For this case, this means that disk
space calculations will start beginning with the newest indices, and
proceeding through to the oldest.
Read more about the different settings for this filtertype:
Required settings
edit- disk_space (required)
Optional settings
edit- reverse (optional)
- use_age (optional)
-
source (required if
use_age
isTrue
) -
timestring (required if
source
isname
) -
field (required if
source
isfield_stats
) -
stats_result (only used if
source
isfield_stats
) -
exclude (default is
False
)