In my spring-boot project, I use spring-data-easticsearch 4.4.5
to connect to the elasticsearch 8.4.3
. Now I have to connect to another very old elasticsearch 2.4
. But according to the doc this version of spring data does not support ES 2.4. How can I connect to this new ES without altering current configuration?
Here are my configs and repos
public class EsConfig extends ElasticsearchConfiguration {
//
@Override
public ClientConfiguration clientConfiguration() {
ClientConfiguration clientConfiguration = ClientConfiguration.builder()
.connectedTo(esUrl)
.usingSsl()
.withBasicAuth(esUserName, esPassword)
.withConnectTimeout(Duration.ofMillis(connectionTimeout))
.withSocketTimeout(Duration.ofMillis(socketTimeout))
.build();
return clientConfiguration;
}
}
and
@Repository
public interface MyRepository extends ElasticsearchRepository<MyEntity, String> {
///
}
I'm not sure if ES 2.4 even already had a REST client to access it or if it was only offering the transport client. But definitely the format of data in Elasticsearch has changed (removal of types and things like that), so that this will not work with current versions anyway.
So I think you need to find some Elasticsearch specific information about migrating.