As discussed in #28496, we're going to refactor our current support of Elasticsearch clients.

The new ElasticsearchClient will be supported in #28597, so this issue is about deprecating the support for RestHighLevelClient. All related auto-configurations and configuration keys should be marked as deprecated as a result.

Comment From: mp911de

Until the new ElasticsearchClient has stabilized and has proven reliable we suggest staying with the RestHighLevelClient. It makes sense to provide infrastructure to pick up ElasticsearchClient if it is on the classpath. RestHighLevelClient has proven to work reliably and should be preferred if both are on the classpath.

The integration and full support of ElasticsearchClient in Spring Data Elasticsearch will take some additional time.

Deprecating support for RestHighLevelClient leaves users without a viable option so deprecation in Boot should happen at a later stage.

Comment From: bclozel

Sounds good @mp911de , thanks for your advice! I've rescheduled for 2.x and we'll reconsider when to tackle this.

Comment From: bclozel

Spring Boot 2.7 upgrades to Elasticsearch 7.16 (see #29292); in that generation, RestHighLevelClient is already deprecated by the Elasticsearch team itself.

Spring Boot support should be naturally deprecated as well; I'll reschedule this issue to its original milestone.

Comment From: wilkinsona

This is a tricky situation as the replacement requires Jakarta EE 9 so it is only suitable for inclusion in Spring Boot 3. I'm not sure if we should still deprecate our support for the old client as we can't offer a replacement until 3.0. On the other hand, it's deprecated in Elasticsearch so it feels odd to have undeprecated support for something that's deprecated.

Comment From: philwebb

We've decided to deprecate our auto-configuration but not yet introduce any support for the new client as it doesn't have feature parity and depends on Jakarta EE 9 APIs.

Comment From: viktorardelean

@bclozel @philwebb I can work on this.

Here is what I would mark as deprecated after looking at the code: RestHighLevelClientConfiguration, RestClientSnifferConfiguration, ElasticSearchRestHealthContributorAutoConfiguration, ElasticsearchRestHealthIndicator, RestClientConfiguration, ElasticsearchRestClientAutoConfiguration.

Let me, please know if I missed something.

Comment From: wilkinsona

Thanks for the offer, @viktorardelean. If you're looking for an issue that's more suited to someone needing some guidance, please keep an eye out for issues labeled as ideal for contribution and, if you haven't contributed before, first-timers only.

Comment From: viktorardelean

@wilkinsona Thank you for your guidance!