How to Install ElasticSearch Data Directory Using Spring Download

My problem is similar to [1] I have a spring loading application where I save some document in elasticsearch. An index is created in the data directory in the current directory each time. I want to change this default path to this one. How can i do this? For such a simple task, it takes hours to find out.

I have tried many things:

  • @Setting(setting="/data/elasticsearch")
  • In the elasticseacrh.properties and application.properties file:
    • path.data
    • spring.data.elasticsearch.path.data

No luck.

+5
source share
3 answers
  • Adding the path to 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 to application properties files using the spring.data.elasticsearch.properties.* Prefix. For instance:

 spring.data.elasticsearch.properties.data.path=/path/to/data 
+5
source

For me (Grails / Spring Boot 1.3.3), the following configuration works better:

 spring.data.elasticsearch.properties.path.data=/path/to/data spring.data.elasticsearch.properties.path.logs=/path/to/logs 
+3
source

I just ran into this problem, and none of the received answers resolved it, the answer accepted received the wrong property, which

  spring.data.elasticsearch.properties.path.data=/path/to/data 

not

  spring.data.elasticsearch.properties.data.path=/path/to/data 

Although you will have a problem with this value because you are writing to the root directory of your computer (in my Mac), which needs permissions that I cannot grant so that the elasticsearch template does not start, instead you need to set the value

 spring.data.elasticsearch.properties.path.data=path/to/data 

This will create a path from the context of your application, which is the root directory of your project, which the application already has write permissions to.

0
source

All Articles