Check health of write index of alias?

Both data streams and Tutorial: Automate rollover with ILM | Elasticsearch Guide [7.17] | Elastic keep old index in alias on rollover. I want check by API my aliases are good for write (meaning health is green or yellow), but because rollover keeps old index in alias, some old cold index can go red and I get alias status red.

Is there way how I can ask about status of only write alias?
Or way ILM can remove previous index from alias after rollover?

Thank you!

Hi @nisow95612 ,

I'm not sure if I understood correctly, but if you run the command below, you will get the answer about the aliases. For example:

GET /_alias/my_alias

result:

{
  "my_index-000001": {
    "aliases": {
      "my_alias": {
        "is_write_index": false
      }
    }
  },
  "my_index-000002": {
    "aliases": {
      "my_alias": {
        "is_write_index": true
      }
    }
  }
}

Would you like to filter the results to show only my_index-000002?

Yes, I can ask all aliases like this, filter for all write index and then ask all that write index for index health. Lot of work and race condion problem.

Monitoring all write indexes is important because if they go red, no new logs can go in.
But monitoring all older indexes is not important. If they go red, compliance is fine.

Here is how I solve it now:
External alias manager, keeps only write index in alias, removes other.
GET /_cat/indices/*_write?format=json&h=index,health&master_timeout=5s
If that show red or yellow anywhere then its an alarm.

But this tool refused 8.0 support so I want switch to ILM for rollover, but this creates problem - command would monitor older indexes and cause false alarms.