-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Do not allow version in Rest Update API #43516
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
Conversation
The versioning of Update API doesn't rely on version number anymore (and rather on sequence number now). But in rest api level we ignored and didn't parse the "version" and "version_type" parameter, so that the server doesn't raise the exception even if we set them. This PR restores "version" and "version_type" parsing in Update Rest API so that we can get the appropriate errors.
Pinging @elastic/es-distributed |
Thank you for working on this PR. I think we should not call |
Hi @dnhatn I see the problem and I updated it to parse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PnPie I am sorry for being slow on this. I left a comment on the validation. Can you also add a YAML test ensuring that we return bad_request
for an update request if version or version_type is provided? Thank you!
server/src/main/java/org/elasticsearch/rest/action/document/RestUpdateAction.java
Outdated
Show resolved
Hide resolved
Change exception thrown from UnsupportedOperationException to ActionRequestValidationException
Hi @dnhatn sorry for being slow on this too. I added a YAML test for this but it throws an exception directly at the YAML test level, before going into rest request parsing part. I see it's because in YAML test update api spec we have removed |
@elasticmachine test this please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left an optional comment but LGTM. Thanks @PnPie for working on this :).
server/src/test/java/org/elasticsearch/rest/action/document/RestUpdateActionTests.java
Outdated
Show resolved
Hide resolved
@elasticmachine update branch |
@elasticmachine test this please |
The versioning of Update API doesn't rely on version number anymore (and rather on sequence number). But in rest api level we ignored the "version" and "version_type" parameter, so that the server cannot raise the exception when whey were set. This PR restores "version" and "version_type" parsing in Update Rest API so that we can get the appropriate errors. Relates to #42497
@PnPie Thanks again for working on this. |
The versioning of Update API doesn't rely on version number anymore (and rather on sequence number). But in rest api level we ignored the "version" and "version_type" parameter, so that the server cannot raise the exception when whey were set.
This PR restores "version" and "version_type" parsing in Update Rest API so that we can get the appropriate errors.
Relates to #42497