How can I use ISM to delete on index-pattern-size?

This page:
Suggests that I can use conditions to decide when to delete an index.
But the algorithm I really want is to delete oldest index until the index-pattern is under the cap.
As far as I can tell, I can only do delete based on the attributes of the index – not the attributes of the index pattern.

If the index is generated at fixed interval, like one log a day. I think maybe cron in conditions satisfy your need to delete oldest index.

Yeah, it seems only age, doc_count and size can be evaluated as condition. I am also curious what is the attribute of index pattern you are referring to?

I have space constraints.
The attribute that I’m looking at is size of index pattern.
I do realize that inspecting the size of the index pattern only by size has some problems (the size may temporarily be larger during a merge). That said, I’d start with

GET my-index*/_stats/store to get the total size
then use
GET _cat/indices/my-index* to get the size of each index
then remove the oldest index in the pattern until the total size is less than the allowed max size