My problem is similar to [1] I have a spring boot appplication where I save some document in elasticsearch. The index is created in a data dir in the current directory each time. I want to change this default path to a given one. How can I do that? A such a simple task takes hours to find it out.
I tried many things:
@Setting(setting="/data/elasticsearch")
application.properties
file:
path.data
spring.data.elasticsearch.path.data
Without any luck.
The Spring Data Elasticsearch project provides integration with the Elasticsearch search engine. Key functional areas of Spring Data Elasticsearch are a POJO centric model for interacting with a Elastichsearch Documents and easily writing a Repository style data access layer.
The ElasticsearchTemplate class is deprecated as it uses the TransportClient to access Elasticsearch, which itself is deprecated since Elasticsearch version 7.
Adding the path with the configuration file in my application class:
@Setting(settingPath = "/home/topic/src/main/resources/elasticsearch.properties")
Set the path.data property in the file:
path.data=/Users/mimis/Desktop/data
Did the trick.
Update:
With Spring Boot 1.3.0 we can add any Elasticsearch property in the application properties files by using the spring.data.elasticsearch.properties.*
prefix. For example:
spring.data.elasticsearch.properties.data.path=/path/to/data
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With