且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在弹簧数据设置中控制弹性搜索配置

更新时间:2023-02-19 08:28:57

您需要在config类中使用@Setting(settingPath =elasticsearch.properties),并在文件中设置path.data属性。



检查我的答案此处


I startup elasticsearch via XML configuration like this:

<elasticsearch:node-client id="client" local="true"/>

Now I need more control on configuration e.g. setting the index files location. How can I achieve this? Can I pass parameter somehow or do I need to specify a config-file location using environment property -Des.config=?

You need to use @Setting(settingPath = "elasticsearch.properties") in your config class and inside the file set the path.data property.

Check my answer here