diff --git a/distribution/src/main/resources/bin/elasticsearch-plugin b/distribution/src/main/resources/bin/elasticsearch-plugin index f686ed054f2..2730a562907 100755 --- a/distribution/src/main/resources/bin/elasticsearch-plugin +++ b/distribution/src/main/resources/bin/elasticsearch-plugin @@ -110,4 +110,4 @@ fi HOSTNAME=`hostname | cut -d. -f1` export HOSTNAME -eval "\"$JAVA\"" -client -Delasticsearch -Des.path.home="\"$ES_HOME\"" $properties -cp "\"$ES_HOME/lib/*\"" org.elasticsearch.plugins.PluginCli $args +eval "\"$JAVA\"" "$ES_JAVA_OPTS" -client -Delasticsearch -Des.path.home="\"$ES_HOME\"" $properties -cp "\"$ES_HOME/lib/*\"" org.elasticsearch.plugins.PluginCli $args diff --git a/distribution/src/main/resources/bin/elasticsearch-plugin.bat b/distribution/src/main/resources/bin/elasticsearch-plugin.bat index 6c6be019fc6..c4286aa7b1c 100644 --- a/distribution/src/main/resources/bin/elasticsearch-plugin.bat +++ b/distribution/src/main/resources/bin/elasticsearch-plugin.bat @@ -48,7 +48,7 @@ GOTO loop SET HOSTNAME=%COMPUTERNAME% -"%JAVA_HOME%\bin\java" -client -Des.path.home="%ES_HOME%" !properties! -cp "%ES_HOME%/lib/*;" "org.elasticsearch.plugins.PluginCli" !args! +"%JAVA_HOME%\bin\java" %ES_JAVA_OPTS% -client -Des.path.home="%ES_HOME%" !properties! -cp "%ES_HOME%/lib/*;" "org.elasticsearch.plugins.PluginCli" !args! goto finally diff --git a/qa/vagrant/src/test/resources/packaging/scripts/module_and_plugin_test_cases.bash b/qa/vagrant/src/test/resources/packaging/scripts/module_and_plugin_test_cases.bash index 382492e245e..85d829718e2 100644 --- a/qa/vagrant/src/test/resources/packaging/scripts/module_and_plugin_test_cases.bash +++ b/qa/vagrant/src/test/resources/packaging/scripts/module_and_plugin_test_cases.bash @@ -476,3 +476,15 @@ fi # restore JAVA_HOME export JAVA_HOME=$java_home } + +@test "[$GROUP] test ES_JAVA_OPTS" { + # preserve ES_JAVA_OPTS + local es_java_opts=$ES_JAVA_OPTS + + export ES_JAVA_OPTS="-XX:+PrintFlagsFinal" + # this will fail if ES_JAVA_OPTS is not passed through + "$ESHOME/bin/elasticsearch-plugin" list | grep MaxHeapSize + + # restore ES_JAVA_OPTS + export ES_JAVA_OPTS=$es_java_opts +}