InternalSettingsPreparer: Settings from external file overridden by initial settings

Hi,

I'm using a setup which creates an elastic search node with some settings
which are
defined in the application (In this case I use the
org.elasticsearch.wares.NodeServlet
which retrieves settings from a file within web application). These
settings are passed
through as follows:

    node = NodeBuilder.nodeBuilder().settings(settings).node();

These default settings are defined within the application, but I would like
to be able
to overwrite these settings from outside the application. I noticed that it
is possible
to define an external configuration by specifying some system properties,
see the
InternalSettingsPreparer:

https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/node/internal/InternalSettingsPreparer.java

When one of the system properties is set (e.g. 'es.default.config') the
file is indeed
read. The problem I'm currently facing is that existing settings are not
replaced by
settings from the external location. It seems that configuration from the
external files
are always overridden by the initial settings. My question is whether this
is intended to
be like this:

  • In the first step the original settings are loaded

line 46: ImmutableSettings.Builder settingsBuilder =
settingsBuilder().put(pSettings);

  • Afterwards (from line 59) the additional properties are loaded from
    external file
    (so far so good)

  • But the properties from the external file are always replaced by the
    original ones,
    because the settings are put in the settings builder again:

line 96: settingsBuilder.put(pSettings);

Is this a bug, or really intended to be like this (and how is that
exactly). To me it
seems that you would like to be able to overwrite these kind of settings
from outside
the application.

Regards Dirkjan

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/e366acbf-e371-48b2-90a7-afb15e229854%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.