Autoscaling based on CPU

I see there is no direct way to autoscale based on CPU and autoscaling is available only for ML and storage.

Is there an alternative way to scale out or scale up my cluster based on cpu? Say, CPU utilisation goes from 50 percent to 80 percent, I want the number of nodes to be increased from 5 to 7.

How is everyone accomplishing autoscaling instead of sizing for peak traffic?

Is this related to Elastic Cloud?

In my eperience there are relatively few Elasticsearch use cases that are limited by CPU. The examples I can think of is where you have a small data set completely cached in memory and very high query rates and possibly also vector search use cases.

The tricky part with scaling out based on CPU load is that you generally add load to the cluster when you scale out, which may happen exactly when the load is the highest, initially causing additional problems rather than helping.

It might help if you could provide more detail around your use case.

Say, I have a food delivery app that receives n requests every hour but at at 7 PM when folks get off of work or Friday night 10 PM, the number of requests increase to 10*n. It doesnt make sense to scale for peak if I know the requests are going to be that high only for an hour or two everyday.

In a scenario like that where peak hours are known I would scale up before the peak using a script and then back down after. That allows you to add the load related to the scaling at a time where it does not affect search latencies.

Is there a sample script available?

No, not that I know of.

But this is a valid ask right? There should be an elastic approved script to use so customers can scale out automatically

I do not see how that would be possible as everyone likely have different requirements. As far as I know there are relatively few who autoscale Elasticsearch due to the reasons I mentioned earlier. If you want to scale an Elastic Cloud deployment at specific times Elastic Cloud has an API which allow you to manipulate environments so that would likely be a good point to start.