Currently trying to start my app but unable because of this exception being thrown when starting app
Caused by: org.springframework.data.elasticsearch.UncategorizedElasticsearchException: Invalid or missing tagline [The OpenSearch Project: https://opensearch.org/]; nested exception is ElasticsearchException[Invalid or missing tagline [The OpenSearch Project: https://opensearch.org/]]
at org.springframework.data.elasticsearch.core.ElasticsearchExceptionTranslator.translateExceptionIfPossible(ElasticsearchExceptionTranslator.java:72)
at org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate.translateException(ElasticsearchRestTemplate.java:427)
The dependencies used are:
- Spring Boot 2.6.6
- Spring Data Elasticsearch 4.3.3
- Rest High Level client 7.5.12 (comes from Spring Data Elasticsearch)
- Java11 & Maven
code:
public interface MyRepo extends ElasticsearchRepository<Document, String> {
config:
@EnableElasticsearchRepositories(basePackages = "repo.package")//where interface above is
...
@Bean
public ClientConfiguration clientConfig() {
return ClientConfiguration.builder()
.connectedTo(elasticsearchUrl)
.usingSsl()
.build();
}
@Bean
public RestHighLevelClient elasticsearchClient(ClientConfig clientConfiguration) {
return RestClients.create(clientConfiguration).rest();
}
@Bean
public ElasticsearchOperations elasticsearchTemplate(RestHighLevelClient restHighLevelClient) {
return new ElasticsearchRestTemplate(restHighLevelClient);
}
I noticed there's a similar question but already trying to downgrade Spring Data Elasticsearch/Rest High Level client to almost every possible version and it didn't work for me (as suggested)
According to Spring documentation here below, those versions should be the right ones for Spring Boot 2.6 . https://docs.spring.io/spring-data/elasticsearch/docs/current/reference/html/#preface.versions
I'm kinda lost here, anything else to try and fix? Thanks
CodePudding user response:
You're probably using a REST client version that is above 7.10.2 (version at which Opensearch made the fork).
If you downgrade your client to 7.10.2 or use the appropriate Opensearch REST client, it will work again.