|
@@ -21,6 +21,12 @@ public class EsConfig {
|
|
|
@Value("${elasticsearch.rest.uris}")
|
|
|
private String hostAndPorts;
|
|
|
|
|
|
+ @Value("${elasticsearch.rest.username}")
|
|
|
+ private String userName;
|
|
|
+
|
|
|
+ @Value("${elasticsearch.rest.password}")
|
|
|
+ private String passWord;
|
|
|
+
|
|
|
|
|
|
@Bean
|
|
|
public RestHighLevelClient elasticsearchClient() {
|
|
@@ -29,6 +35,7 @@ public class EsConfig {
|
|
|
.connectedTo(hostAndPort)
|
|
|
.withConnectTimeout(Duration.ofSeconds(5))
|
|
|
.withSocketTimeout(Duration.ofSeconds(3))
|
|
|
+ .withBasicAuth(userName, passWord)
|
|
|
.build();
|
|
|
|
|
|
return RestClients.create(clientConfiguration).rest();
|