I have the following scenario that I want to handle with curator python api:
I want to delete indices when my cluster storage reaches a fixed water mark (for example - 1TB).
But, I want to delete indices by a certain order. I have 3 groups of indices with different priorities for deletion.
First, I want to delete indices from the first group, from the oldest to the newest (but not newer than 1 month) until the total space of the cluster reaches the desired water mark.
If the water mark is not reached, I want to continue and delete indices from the second group, from the oldest to the newest (but not newer than 3 months) until the total space of the cluster reaches the desired water mark.
From the third group I never delete indices.
I was not able to figure out how to implement this with curator python api.
I tried to filter out all indices but the ones from the first group which are newer than 1 month, which I want to delete first. Then I would have liked to call filter_by_space. But to do that, I had to provide disk_space parameter, which is the desired space that this specific group of indices should take. This was inconvenient for me because I only know how much space should the total cluster take, not this specific group of indices.
So my solution was:
Calculate the amount of storage I have to delete.
Calculate the size of the group of loud indices
Reduce the size to delete from the size of the group (check that it is not below zero) and pass the result to filter_by_space.
This solution is not clean and requires many calculations.
I would have liked to suggest adding filter_by_space would check how much space does the whole cluster take (and not the specific group of indices) OR add the possibility to receive space_to_clean, meaning - how much storage to delete, but maybe I am missing something.
Do you have any suggestions how to handle this scenario better?