How can I pass an empty array when putting settings as an environment variable?

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser): OpenSearch 2.8.0 and above

Describe the issue:

How can I pass an empty array when putting settings as an environment variable?

As I know, if I don’t set node.roles, the node will have all the built-in roles (cluster_manager, data, ingest, search and remote_cluster_client) and if I set node.roles to an empty array, it will be a dedicated coordinating node.

The problem is that I can’t write the value directly into opensearch.yml and need to pass those settings via environment variables. Like:

# in opensearch.yml
node.roles: ${NODE_ROLES}

I want to create a dedicated coordinating node, so I was wondering what value I should put in the NODE_ROLES environment variable.

I tried a few values:

  • NODE_ROLES="": It’s treated as null. Set all builtin roles.
  • NODE_ROLES=",": Same as ""
  • NODE_ROLES="[]": It makes a dynamic role that is named "[]"! That makes the node coordinating-dedicated as a result but currently most of OpenSearch client libraries don’t support dynamic roles and raise DeserializationFailedException.
  • node_roles="[,]": Same as "[]"

How can I pass an empty array to settings via environment variables ?

Relevant Logs or Screenshots:

@jeongmin please check [BUG] OpenSearch app is not able to pick up empty `node.roles=` environment variable to run as coordinating node. · Issue #3412 · opensearch-project/OpenSearch · GitHub, thank you

1 Like