How to get environment variblae in elasticsearch.yml file in elasticsearch-5.4.0


(Rajkumar) #1

I have installed elasticsearch-5.4.0, its not take my envornoment variable in elasticsearch.yml file its throw "Exception in thread "main" java.lang.IllegalArgumentException: Could not resolve placeholder 'DOCKER_IP'"

i follow this document, same confiuration works in elasticsearch2.4.2, but not works 5.4.0

elasticsearch.yml:

 network.host: ${DOCKER_IP}
   http.port: 9200
   action.destructive_requires_name: true

Full Error:

     Exception in thread "main" java.lang.IllegalArgumentException: Could not resolve placeholder 'DOCKER_IP'
	at org.elasticsearch.common.settings.PropertyPlaceholder.parseStringValue(PropertyPlaceholder.java:116)
	at org.elasticsearch.common.settings.PropertyPlaceholder.replacePlaceholders(PropertyPlaceholder.java:69)
	at org.elasticsearch.common.settings.Settings$Builder.replacePropertyPlaceholders(Settings.java:1096)
	at org.elasticsearch.common.settings.Settings$Builder.replacePropertyPlaceholders(Settings.java:1056)
	at org.elasticsearch.node.InternalSettingsPreparer.initializeSettings(InternalSettingsPreparer.java:136)
	at org.elasticsearch.node.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:115)
	at org.elasticsearch.cli.EnvironmentAwareCommand.createEnv(EnvironmentAwareCommand.java:72)
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:67)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122)
	at org.elasticsearch.cli.Command.main(Command.java:88)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84)

Suggest me How to fix this issue.


(David Pilato) #2

May be you can run with

bin/elasticsearch -Enetwork.host=${DOCKER_IP}

Or something like this?

But here I think ${DOCKER_IP} is not resolved to anything...
It supposed to be an ENV VAR: https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html#_environment_variable_substitution


(system) #3

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