스프링 부트에 high level 엘라스틱서치 클라이언트 적용

dependencies

1
2
3
4
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
</dependency>

Config

1
2
3
4
5
6
7
8
9
10
11
12
13

@Configuration
@AllArgsConstructor
public class ElasticsearchConfig {
private final String host = "XXX.XXX.XXX.XXX";
private final int port = 9200;

@Bean
public RestHighLevelClient client() {
return new RestHighLevelClient(RestClient.builder(new HttpHost(host, port, "http")));
}
}

Share