Limit number of shards on a particular Elasticsearch node

I have a huge 300 node Elasticsearch cluster and the machines added over the years are with different configuration.

By default, elasticsearch tries to make sure equal number of shards exists on each and every node of the cluster. Since, my node size is non-uniform, I want to limit number of shards on certain nodes.

This property cluster.routing.allocation.total_shards_per_node is cluster level setting and limits the number of shards on every node in the cluster.

Can someone suggest what is the ideal way of doing this?

What version are you on?

6.8.3