diff --git a/src/main/java/org/elasticsearch/node/internal/InternalSettingsPerparer.java b/src/main/java/org/elasticsearch/node/internal/InternalSettingsPerparer.java index ce7605bb05a..ccaefcd2050 100644 --- a/src/main/java/org/elasticsearch/node/internal/InternalSettingsPerparer.java +++ b/src/main/java/org/elasticsearch/node/internal/InternalSettingsPerparer.java @@ -39,6 +39,8 @@ public class InternalSettingsPerparer { // just create enough settings to build the environment ImmutableSettings.Builder settingsBuilder = settingsBuilder() .put(pSettings) + .putProperties("elasticsearch.default.", System.getProperties()) + .putProperties("es.default.", System.getProperties()) .putProperties("elasticsearch.", System.getProperties()) .putProperties("es.", System.getProperties()) .replacePropertyPlaceholders(); @@ -46,16 +48,22 @@ public class InternalSettingsPerparer { Environment environment = new Environment(settingsBuilder.build()); if (loadConfigSettings) { - boolean explicitSettingsProvided = false; + boolean loadFromEnv = true; + // if its default, then load it, but also load form env + if (System.getProperty("es.default.config") != null) { + loadFromEnv = true; + settingsBuilder.loadFromUrl(environment.resolveConfig(System.getProperty("es.config"))); + } + // if explicit, just load it and don't load from env if (System.getProperty("es.config") != null) { - explicitSettingsProvided = true; + loadFromEnv = false; settingsBuilder.loadFromUrl(environment.resolveConfig(System.getProperty("es.config"))); } if (System.getProperty("elasticsearch.config") != null) { - explicitSettingsProvided = true; + loadFromEnv = false; settingsBuilder.loadFromUrl(environment.resolveConfig(System.getProperty("elasticsearch.config"))); } - if (!explicitSettingsProvided) { + if (loadFromEnv) { try { settingsBuilder.loadFromUrl(environment.resolveConfig("elasticsearch.yml")); } catch (FailedToResolveConfigException e) {