Skip to content

Incorrect Update API Path #2276

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

Closed
tenaciousprevailer opened this issue Aug 22, 2022 · 5 comments · Fixed by #2281
Closed

Incorrect Update API Path #2276

tenaciousprevailer opened this issue Aug 22, 2022 · 5 comments · Fixed by #2281
Assignees
Labels
type: bug A general bug

Comments

@tenaciousprevailer
Copy link

Spring Boot Version: 2.7.3 (Issue exists in 2.7.2, tried in that)
Elasticsearch Server Version: 8.1.2
The update path that spring data elastic search uses is:
POST /index/_doc/{docId}/_update
which gives error: no handler found for uri

Instead the path should be:
POST /index/_update/{docId}

Please fix this. I've to do a lot of workarounds to fix it.

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

sothawo commented Aug 22, 2022

Please provide a runnable code/ minimal project that demonstrates this error.

@sothawo sothawo added status: waiting-for-feedback We need additional information before we can continue and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 22, 2022
@tenaciousprevailer
Copy link
Author

From org.springframework.data.elasticsearch.client.util.RequestConverters.update(UpdateRequest updateRequest)

Below is the code snippet.
public static Request update(UpdateRequest updateRequest) {
String endpoint = endpoint(updateRequest.index(), updateRequest.type(), updateRequest.id(), "_update");

This is causing the error, the endpoint generated is incorrect.
Refer the article on what the endpoint should be: https://www.elastic.co/guide/en/elasticsearch/reference/7.17/docs-update.html

Code FIX (Suggestion, Please review & test before accepting) :P:
String endpoint = endpoint(updateRequest.index(), "_update", updateRequest.id());

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Aug 22, 2022
@sothawo sothawo added type: bug A general bug and removed status: feedback-provided Feedback has been provided labels Aug 23, 2022
@sothawo sothawo self-assigned this Aug 23, 2022
@sothawo
Copy link
Collaborator

sothawo commented Aug 23, 2022

Seems no one else up to now used update with the reactive implementation, thanks for bringing this
up.

For the reactive client implementation up to version 4.4 we needed to copy code from the Elasticsearch library (it was still allowed at that time). This copied code was not adapted when in version 7 the type parameter was removed.

sothawo added a commit that referenced this issue Aug 26, 2022
sothawo added a commit that referenced this issue Aug 26, 2022
Original Pull Request #2281
Closes #2276

(cherry picked from commit 8377f64)
sothawo added a commit that referenced this issue Aug 26, 2022
Original Pull Request #2281
Closes #2276

(cherry picked from commit 8377f64)
(cherry picked from commit a3ebd8b)
@tenaciousprevailer
Copy link
Author

@sothawo
can you please provide release version, the fix will be part of ?

@sothawo
Copy link
Collaborator

sothawo commented Aug 26, 2022

It will be in the next major release as well in the next bugfix releases for 4.4 and 4.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants