How to monitor the size of elasticsearch index

Do you have a solution for elasticsearch index size monitoring?

For example, the index pit doesn't scroll according to the lifetime I set for various reasons, so it can get big. At this point, I would like to receive an alert or prompt.

Normally, 30GB might roll, but I want to be alerted when 35GB hasn't rolled yet.

There are a few ways to check on your index size.
You can set up monitoring

You can use the cat API to ask about your index size:

GET /_cat/indices/my-index-*?v=true&s=index

You can schedule to run and collect this information periodically and take action if the size goes above what your policy states.

Elastic has a Watcher you can use to set up these kind of tasks.
There's an official example repo with a few useful ones for inspiration on how to set up the conditions / alerts / timing parameters to get exactly what you want.

You can see an example similar to your request using these tools here:

2 Likes