# InternalSettingsPreparer: Settings from external file overridden by initial settings

**URL:** <https://discuss.elastic.co/t/internalsettingspreparer-settings-from-external-file-overridden-by-initial-settings/16461>\
**Category:** Elasticsearch\
**Created:** [March 19, 2014, 11:27am UTC](https://discuss.elastic.co/t/internalsettingspreparer-settings-from-external-file-overridden-by-initial-settings/16461 "2014-03-19T11:27:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![D\_van\_Diepen](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@D\_van\_Diepen](https://discuss.elastic.co/u/D_van_Diepen)\
**Post date:** [March 19, 2014, 11:27am UTC](https://discuss.elastic.co/t/internalsettingspreparer-settings-from-external-file-overridden-by-initial-settings/16461/1 "2014-03-19T11:27:29Z")

</div>

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](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](mailto: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](https://groups.google.com/d/msgid/elasticsearch/e366acbf-e371-48b2-90a7-afb15e229854%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:42am UTC](https://discuss.elastic.co/t/internalsettingspreparer-settings-from-external-file-overridden-by-initial-settings/16461/2 "2017-07-06T01:42:14Z")

</div>


