Skip to content
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

Add status field to MultiSearchTemplateResponse #85496

Merged

Conversation

AbeleMM
Copy link
Contributor

@AbeleMM AbeleMM commented Mar 30, 2022

Addresses #83029.
Adds status field to MultiSearchTemplateResponse, as is already the case for MultiSearchResponse. Tried to touch as little code as necessary to allow for the change, while also mimicking the structure of MultiSearchResponse and SearchResponse as much as possible.

@elasticsearchmachine elasticsearchmachine added v8.2.0 external-contributor Pull request authored by a developer outside the Elasticsearch team labels Mar 30, 2022
@AbeleMM AbeleMM marked this pull request as ready for review March 30, 2022 16:27
@jtibshirani jtibshirani added the :Search/Search Search-related issues that do not fall into other categories label Apr 21, 2022
@elasticmachine elasticmachine added the Team:Search Meta label for search team label Apr 21, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

@cbuescher cbuescher self-assigned this May 19, 2022
@cbuescher
Copy link
Member

Hi @AbeleMM, thanks for your help with this issue and apologies that it took a bit to pick up your PR. I looked at the change and it looks good. We will need some sort of test however. There are two options for this. First, there are unit test "MultiSearchTemplateRequestTests" and "MultiSearchResponseTests", both of which so far unfortunately don't test the xContent output. I would probably use a fixed response object and write the json output to a String, something like in "org.elasticsearch.index.rankeval.RankEvalResponseTests#testToXContent" maybe.
The second option would be to modify the rest test we have under modules/lang-mustache/src/yamlRestTest/resources/rest-api-spec/test/lang_mustache/50_multi_search_template.yml. These are request/response pairs written in yaml. You can take a look at how the corresponding _msearch tests look like at rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/msearch/11_status.yml. They already test the existence of the status field, something that would have to be added to the tests under modules/lang-mustache/src/yamlRestTest/resources/rest-api-spec/test/lang_mustache.
If you need more pointers or help adding or running the test let me know, I can also take care of it if you don't have the time to do so.

@AbeleMM
Copy link
Contributor Author

AbeleMM commented May 20, 2022

Hi @AbeleMM, thanks for your help with this issue and apologies that it took a bit to pick up your PR. I looked at the change and it looks good. We will need some sort of test however. There are two options for this. First, there are unit test "MultiSearchTemplateRequestTests" and "MultiSearchResponseTests", both of which so far unfortunately don't test the xContent output. I would probably use a fixed response object and write the json output to a String, something like in "org.elasticsearch.index.rankeval.RankEvalResponseTests#testToXContent" maybe. The second option would be to modify the rest test we have under modules/lang-mustache/src/yamlRestTest/resources/rest-api-spec/test/lang_mustache/50_multi_search_template.yml. These are request/response pairs written in yaml. You can take a look at how the corresponding _msearch tests look like at rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/msearch/11_status.yml. They already test the existence of the status field, something that would have to be added to the tests under modules/lang-mustache/src/yamlRestTest/resources/rest-api-spec/test/lang_mustache. If you need more pointers or help adding or running the test let me know, I can also take care of it if you don't have the time to do so.

@cbuescher Thank you for the helpful comment! I have added checks for the status of response items to the existing tests in modules/lang-mustache/src/yamlRestTest/resources/rest-api-spec/test/lang_mustache/50_multi_search_template.yml. Please let me know about any further changes/updates required.

@cbuescher
Copy link
Member

Thanks @AbeleMM, that looks great. I will probably need to push a few minor changes myself to the branch if that is okay to make the test work with the backward compatibility checks of our CI, but want to spare you the details. Hope its okay if me / our bot pushes to this branch a bit. Will run the tests after merging in master.

@AbeleMM
Copy link
Contributor Author

AbeleMM commented May 20, 2022

Thanks @AbeleMM, that looks great. I will probably need to push a few minor changes myself to the branch if that is okay to make the test work with the backward compatibility checks of our CI, but want to spare you the details. Hope its okay if me / our bot pushes to this branch a bit. Will run the tests after merging in master.

Sounds great!

@cbuescher
Copy link
Member

@elasticmachine update branch

Copy link
Member

@cbuescher cbuescher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cbuescher
Copy link
Member

@elasticmachine update branch

@cbuescher
Copy link
Member

@elasticmachine test this please

@cbuescher
Copy link
Member

@elasticmachine test this please

@cbuescher
Copy link
Member

@elasticmachine run elasticsearch-ci/packaging-tests-windows-sample

@cbuescher
Copy link
Member

@AbeleMM thanks a lot for your contribution an the quick replies, much appreciated.

@AbeleMM
Copy link
Contributor Author

AbeleMM commented May 20, 2022

@AbeleMM thanks a lot for your contribution an the quick replies, much appreciated.

Thank you for the guidance!

@AbeleMM AbeleMM deleted the 83029-discrepancy-msearch-msearch_template branch May 20, 2022 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug external-contributor Pull request authored by a developer outside the Elasticsearch team :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team v8.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants