Deleting Elasticsearch Indices By Timestamp
Resource management is one of the essential things in the software community. Therefore the document was written to delete indices that start with the given prefix.
It needs two files. One of them is curator config.yml whose name is curator.yml and the second file is test-delete-indices.yml.
YAML-base Curator Configuration
Elasticsearch host which is in the environment must be written like above 127.0.0.1 if it is local.
Once the two YAML files are configured, you can initiate a dry run of curator execution with the following command.
The — dry-run mode will not delete the index. It can be used to verify the output of the action.
Once the dry run verification is completed, you can schedule the actual run in cron, using crontab -e as shown below.
Note: /path/.. must be written correctly as located.
Note: The result of this command is a written log.log file.
It will be all indices after 3 days.
test-first-incides_20210526
test-first-incides_20210525
test-first-incides_20210524
test-first-incides_20210523 will be deleted
test-first-incides_20210522 will be deleted
…
…
Thanks for reading..