I'm using Spring Boot 1.2.5 and Spring-Boot-Starter-Data-Elasticsearch. I have a custom elasticsearch class which represents a node and connects to a remote ES instance. Everything works fine but when I start the application, two ES nodes are started instead of a single one (Overkill and Serpentina in the following log example).
I tried using Spring-Data-Elasticsearch or simply remove ES from pom but it did not help. Starter-Data-Elasticsearch is needed to fulfill dependencies and as soon as it's added, it starts two nodes.
I also found this question and tried to add spring.data.elasticsearch.local=false
to application.properties but it didn't change anything.
I tried adding @EnableConfigurationProperties(ElasticsearchProperties.class)
to my application class but the application doesn't start because of missing dependencies.
I can't find a possibility to deactivate the default node. How can I disable it?
Startup log:
[ main] org.elasticsearch.node : [Overkill] version[1.3.2], pid[2316], build[dee175d/2014-08-13T14:29:30Z]
[ main] org.elasticsearch.node : [Overkill] initializing ...
[ main] org.elasticsearch.plugins : [Overkill] loaded [], sites []
[ main] org.elasticsearch.node : [Overkill] initialized
[ main] org.elasticsearch.node : [Overkill] starting ...
[ main] org.elasticsearch.transport : [Overkill] bound_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish_address {inet[/192.168.173.22:9300]}
[ main] org.elasticsearch.discovery : [Overkill] xyz/15kRC2sHR0SKamJerq0EXw
[ main] org.elasticsearch.discovery : [Overkill] waited for 30s and no initial state was set by the discovery
[ main] org.elasticsearch.http : [Overkill] bound_address {inet[/0:0:0:0:0:0:0:0:9200]}, publish_address {inet[/192.168.173.22:9200]}
[...]
[ main] org.elasticsearch.node : [Serpentina] version[1.3.2], pid[2316], build[dee175d/2014-08-13T14:29:30Z]
[ main] org.elasticsearch.node : [Serpentina] initializing ...
[ main] org.elasticsearch.plugins : [Serpentina] loaded [], sites []
[ main] org.elasticsearch.node : [Serpentina] initialized
[ main] org.elasticsearch.node : [Serpentina] starting ...
[ main] org.elasticsearch.transport : [Serpentina] bound_address {local[1]}, publish_address {local[1]}
[ main] org.elasticsearch.discovery : [Serpentina] elasticsearch/f5g45CHHSaCqrD8AFyNGWQ
[pdateTask][T#1]] org.elasticsearch.cluster.service : [Serpentina] new_master [Serpentina][f5g45CHHSaCqrD8AFyNGWQ][Blu][local[1]]{local=true}, reason: local-disco-initial_connect(master)
[ main] org.elasticsearch.node : [Serpentina] started
[pdateTask][T#1]] org.elasticsearch.gateway : [Serpentina] recovered [0] indices into cluster_state
My ES class:
@Repository
public class XyzRepository {
private Node node;
private Client client;
public XyzRepository (){
this.node = nodeBuilder().client(true).clusterName("clusterName").node();
this.client = node.client();
}
[... some functions...]
}
pom.xml:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
[...properties...]
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
[...other dependencies...]