Skip to content

Update Elasticsearch client to version 9.x #3110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
l-trotta opened this issue May 15, 2025 · 2 comments
Open

Update Elasticsearch client to version 9.x #3110

l-trotta opened this issue May 15, 2025 · 2 comments
Labels
status: waiting-for-triage An issue we've not yet triaged

Comments

@l-trotta
Copy link

The Elasticsearch java client released a new major version 9.0, introducing a number of breaking changes that will affect this and other spring projects.
I have a draft ready with the minimal changes to make spring-data-elasticsearch work with version 9.0.1 of the client; I'd like to open a PR where we could discuss those and other possible changes, which could be part of the next major release of spring-data-elasticsearch.

Disclaimer: I am one of the maintainer of https://github.com/elastic/elasticsearch-java

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 15, 2025
@sothawo
Copy link
Collaborator

sothawo commented May 17, 2025

Hi Laura, thank you very much, I really appreciate your support. As we had version 5.5 released yesterday, we now can go forward to integrate Elasticsearch 9 for the next release in autumn.

I hope I'll find the time this weekend to have a look at your changes, and see how this fits in - I'm thinking about backwards compatibility, how to provide the new client, what to do if users were currently providing their own RestClient bean and things like that.

As this is not my daytime job and I got some other hobbies as well, it might take some days...

@l-trotta
Copy link
Author

Hello, thanks for the quick reply! And no worries there's no rush :) also there's no plan on doing any other major changes for a while, so this is just early planning.
For now what I did is just the bare minimum to make it work, but there are still some open questions:

  1. In version 9 we introduced a new implementation of the RestClient (transport). The legacy one still works, but we'll deprecate it after a while (~version 9.5) since it's based on an already deprecated library (apache http client 4.x). We were thinking that Spring could follow the same approach the client does, so offer both options for users to choose; what I'm not sure about is which one should be the default option. I can update my draft with an initial implementation, but if I understood correctly this particular change would have to be done in the spring-boot repo right?
  2. One of the major breaking changes in version 9 involves the Script class: the elasticsearch server accepts not only strings as the Script source, but also SearchTemplates (docs), which in java terms means it can accept either a String or the whole SearchRequest body. Do you think we could add this option in Spring Data too? I can provide an implementation for this, but it will probably introduce breaking changes in the builders.

I will do more testing to see if there are more issues, but all other breaking changes I already took care of in the draft. Let me know if there's more info I can provide!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

No branches or pull requests

3 participants