-
Notifications
You must be signed in to change notification settings - Fork 25.2k
HEAD support for the _search/exists api #13680
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
Registers the `_search/exists` api to receive HEAD requests. If it gets one then it won't output the JSON response but will still do everything else. Adds magic to the rest tests to ignore `catch: missing` for HEAD requests. This behavior is checked instead with `- is_false: anystring`. This setup makes the rest tests for `search/_exists` work for HEAD requests. Also forces the request body over the source URL parameter for all HEAD requests. Closes elastic#11204
Ping @honzakral and maybe @areek for review. The linked issue mentions some client API changes but I think what we have now makes sense as |
I cannot speak for the code (LGTM but I am not a java person) but we should also change the yaml tests (https://github.com/nik9000/elasticsearch/tree/search_exists_head/rest-api-spec/src/main/resources/rest-api-spec/test/search_exists) to not check the body and instead behave as other Thanks! |
As I've got them right now the REST tests only look at the body if the request was GET or POST and then they still verify what they used to verify. If the request was HEAD they just check for the 404. I did it in a sneaky way though. |
Not after this patch it won't. Not in the Java version. That is what I mean by
The operative change is here. |
I'm fine with doing it in another way but this was the only way I could figure to keep the specs logicless and to test the body when there was one and the 404-ness when there wasn't. |
According to the specs of the yaml test suite this should fail with HEAD: https://github.com/nik9000/elasticsearch/tree/search_exists_head/rest-api-spec/src/main/resources/rest-api-spec/test#is_true specifies that the key must exist for this assertion to pass. |
There are specs for this?! Nice! I had no idea. They are out of date though - So what do you want:
|
I think |
Everywhere else HEAD requests get an implicit |
Search exists has been removed from master. We are still discussing in #11204 whether we should add support for |
@javanna agreed! |
Registers the
_search/exists
api to receive HEAD requests. If it gets onethen it won't output the JSON response but will still do everything else.
Adds magic to the rest tests to ignore
catch: missing
for HEAD requests.This behavior is checked instead with
- is_false: anystring
. This setupmakes the rest tests for
search/_exists
work for HEAD requests.Also forces the request body over the source URL parameter for all HEAD
requests.
Closes #11204