How to set default value while using env in elasticsearch.yml config file?

I'm using environment variable in config file (ie. elasticsearch.yml) to configure node roles.

For example:


node.roles: '${NODE_ROLES}'

When, I set NODE_ROLES="master", NODE_ROLES="ml, remote_cluster_client", etc. They work as expected.

But, When I try to create a coordinating node by setting, NODE_ROLES="", seems like it doesn't work. Showing all node roles are assigned to coordinating nodes.

$ curl -XGET -k -u 'elastic:XpBr*PVVgPa&zK5M' "https://localhost:9200/_cat/nodes?v"
ip        heap.percent ram.percent cpu load_1m load_5m load_15m node.role   master name           59          74  42    2.40    1.83     1.23 m           -      es-master-0
... ... ..           69           2  19    0.78    0.48     0.33 cdfhilmrstw -      es-coordinating-0

I also tried setting default values like below, they also didn't work.

node.roles: '${NODE_ROLES:""}'
node.roles: '${NODE_ROLES:[]}'

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.