Delete index only if there is a minimum of two indexes more available

Context:

  1. We have an airflow pipeline that generates some data and indexes to the cluster every day.
  2. We have a few clients that perform KNN based on the data features.

Goal

  1. Delete old indexes after 48h period of time
    • This is can be done by moving hot state to delete after specifying the min_index_age in the ISM and providing the index_patterns
  2. Retrieve the latest index on the client-side
    • This is can be done on the python SDK, by retrieving all the indexes and sorting them
  3. Make sure that a minimum of one index is present before the actual delete job begins
    • I am not sure if the ISM is flexible for this kinda request

TLDR
Can I delete indexes with conditional logic? i.e. Delete index if there is a minimum of one more index in the cluster