2

I'm using Jest at enter link description here in my spring boot application.

Then I created the client with the example code :

JestClientFactory factory = new JestClientFactory();
 factory.setHttpClientConfig(new HttpClientConfig
                        .Builder("http://myhost:9200")
                        .multiThreaded(true)
 
 JestClient client = factory.getObject();

Everything is fine. I can use this client to do all the queries I want. Happy till now.

Then the problem, when the application starts up, ElasticsearchJestHealthIndicator class is auto-initialized. But the problem is I don't know where to set the config that it will need, so it uses the default value as http://localhost:9200, which leads me to this problem:

WARN [on(2)-127.0.0.1] s.b.a.h.ElasticsearchJestHealthIndicator : Health check failed io.searchbox.client.config.exception.CouldNotConnectException: Could not connect to http://localhost:9200 at io.searchbox.client.http.JestHttpClient.execute(JestHttpClient.java:70) at io.searchbox.client.http.JestHttpClient.execute(JestHttpClient.java:60)

Can someone show me how to properly config it , or turn it off ?

Machavity
  • 30,841
  • 27
  • 92
  • 100
Xitrum
  • 7,765
  • 26
  • 90
  • 126

2 Answers2

4

A quick search in the reference documentation shows that Spring Boot will configure for you a JestClient (you can just inject it anywhere you need), and that the following configuration properties apply:

spring.elasticsearch.jest.uris=http://search.example.com:9200
spring.elasticsearch.jest.read-timeout=10000
spring.elasticsearch.jest.username=user
spring.elasticsearch.jest.password=secret

See here for more on this.

Brian Clozel
  • 56,583
  • 15
  • 167
  • 176
0

The Jest client has been deprecated as well, since both Elasticsearch and Spring Data Elasticsearch provide official support for REST clients.

See https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-elasticsearch

Sifeng
  • 713
  • 9
  • 23