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

**URL:** <https://discuss.elastic.co/t/how-to-set-default-value-while-using-env-in-elasticsearch-yml-config-file/275440>\
**Category:** Elasticsearch\
**Created:** [June 9, 2021, 1:12pm UTC](https://discuss.elastic.co/t/how-to-set-default-value-while-using-env-in-elasticsearch-yml-config-file/275440 "2021-06-09T13:12:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kamolhasan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kamolhasan/32/76540_2.png) [@kamolhasan](https://discuss.elastic.co/u/kamolhasan)\
**Post date:** [June 9, 2021, 1:12pm UTC](https://discuss.elastic.co/t/how-to-set-default-value-while-using-env-in-elasticsearch-yml-config-file/275440/1 "2021-06-09T13:12:31Z")

</div>

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

For example:

**elasticsearch.yml:**

```auto
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.

```auto
$ 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
10.2.2.23 59 74 42 2.40 1.83 1.23 m - es-master-0
... ... ..
10.2.0.18 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.

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

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 7, 2021, 1:13pm UTC](https://discuss.elastic.co/t/how-to-set-default-value-while-using-env-in-elasticsearch-yml-config-file/275440/2 "2021-07-07T13:13:03Z")

</div>

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