The first (first-elasticsearch.yml) will be package in my jar* file,
and the second will be externalized. https://gist.github.com/1334242
It almost works but something looks strange in the
InternalSettingsPerparer.
builder.settings().loadFromClasspath load the first file and the
path.config is resolved.
builder.build() instantiate a new InternalNode() which run
InternalSettingsPerparer.prepareSettings(pSettings,
loadConfigSettings).
prepareSettings load the file by using
settingsBuilder.loadFromUrl(environment.resolveConfig("elasticsearch.yml"));
settingsBuilder no contains the new value
~But in the end prepareSettings(..) execute
settingsBuilder.put(pSettings). This will restore the previous values :
(.
Is it a feature to override last loaded properties with the initial
settings ? I can't understand the need of calling the
settingsBuilder.put(pSettings) two times.
@Shay In the same time I think there's a typo in the class name
Perparer instead of Preparer.
I am not sure I follow... . Do you mean that you expect the
first-elasticsearch.yml setting to override the ones loaded by
elasticsearch automatically from the classpath?
The first (first-elasticsearch.yml) will be package in my jar* file,
and the second will be externalized. https://gist.github.com/1334242
It almost works but something looks strange in the
InternalSettingsPerparer.
builder.settings().loadFromClasspath load the first file and the
path.config is resolved.
builder.build() instantiate a new InternalNode() which run
InternalSettingsPerparer.prepareSettings(pSettings,
loadConfigSettings).
prepareSettings load the file by using
settingsBuilder.loadFromUrl(environment.resolveConfig("elasticsearch.yml"));
settingsBuilder no contains the new value
~But in the end prepareSettings(..) execute
settingsBuilder.put(pSettings). This will restore the previous values :
(.
Is it a feature to override last loaded properties with the initial
settings ? I can't understand the need of calling the
settingsBuilder.put(pSettings) two times.
@Shay In the same time I think there's a typo in the class name
Perparer instead of Preparer.
What you describe it's not what I expect, it's what's happened !
The "firts-elasticsearch.yml" is load from classpath (coded in my
methode) and define the location of the second. The second is loaded
when the node is create but even if the properties are loaded the
second call of settingsBuilder.put(pSettings) restore the properties
comming from the first file.
I just want to define configuration in my jar and be able to override
some properties when needed by server administrator.( like cluster-
name, allowed ip,.. )
I am not sure I follow... . Do you mean that you expect the
first-elasticsearch.yml setting to override the ones loaded by
elasticsearch automatically from the classpath?
The first (first-elasticsearch.yml) will be package in my jar* file,
and the second will be externalized.https://gist.github.com/1334242
It almost works but something looks strange in the
InternalSettingsPerparer.
builder.settings().loadFromClasspath load the first file and the
path.config is resolved.
builder.build() instantiate a new InternalNode() which run
InternalSettingsPerparer.prepareSettings(pSettings,
loadConfigSettings).
prepareSettings load the file by using
settingsBuilder.loadFromUrl(environment.resolveConfig("elasticsearch.yml")) ;
settingsBuilder no contains the new value
~But in the end prepareSettings(..) execute
settingsBuilder.put(pSettings). This will restore the previous values :
(.
Is it a feature to override last loaded properties with the initial
settings ? I can't understand the need of calling the
settingsBuilder.put(pSettings) two times.
@Shay In the same time I think there's a typo in the class name
Perparer instead of Preparer.
Thats the order that its executed... . There is no reason though that you
can't simply construct your own settings object, load into the data from
the two files (in the order that you want), and then pass the settings to
the node builder. You can also configure it to not load the default
settings.
What you describe it's not what I expect, it's what's happened !
The "firts-elasticsearch.yml" is load from classpath (coded in my
methode) and define the location of the second. The second is loaded
when the node is create but even if the properties are loaded the
second call of settingsBuilder.put(pSettings) restore the properties
comming from the first file.
I just want to define configuration in my jar and be able to override
some properties when needed by server administrator.( like cluster-
name, allowed ip,.. )
I am not sure I follow... . Do you mean that you expect the
first-elasticsearch.yml setting to override the ones loaded by
elasticsearch automatically from the classpath?
settingsBuilder no contains the new value
~But in the end prepareSettings(..) execute
settingsBuilder.put(pSettings). This will restore the previous values :
(.
Is it a feature to override last loaded properties with the initial
settings ? I can't understand the need of calling the
settingsBuilder.put(pSettings) two times.
@Shay In the same time I think there's a typo in the class name
Perparer instead of Preparer.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.