Tag nodes with REST API

Is it possible to tag a node with REST API instead of defining in elasticsearch.yml? The intention is to use the tag with index.routing.allocation.include.group property. I am aware of how to define such a tag in config. But I cannot find any reference on how it can be done dynamically or not.

It cannot be done dynamically.
You can use things like node IP and hostname though, take a look here at the bottom of the section.

Thanks.