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

Fix parsing single rescore element in SearchSourceBuilder #18440

Merged
merged 1 commit into from May 18, 2016

Conversation

cbuescher
Copy link
Member

We are currently only parsing the array-syntax for the rescore part in SearchSourceBuilder ("rescore" : [ {...}, {...} ]) .
We also used to support "rescore" : {...}, so adding this back to the parsing in SearchSourceBuilder.

Closes #18439

@cbuescher cbuescher added >bug review :Search/Search Search-related issues that do not fall into other categories v5.0.0-alpha3 labels May 18, 2016
@cbuescher
Copy link
Member Author

@MaineC can you take a look at this and try this change with the query you used in #18439? I added a simplified version to the json parsing tests that I think will also work for the issue you reported.

@MaineC
Copy link

MaineC commented May 18, 2016

LGTM - thanks for fixing

We are currently only parsing the array-syntax for the rescore part
in SearchSourceBuilder ("rescore" : [ {...}, {...} ]) . We also need
to support "rescore" : {...}

Closes elastic#18439
@cbuescher cbuescher merged commit 808ef6c into elastic:master May 18, 2016
@nik9000
Copy link
Member

nik9000 commented May 18, 2016

Should SourceSoureBuilder#toXContent spit out just the rescore object if there is only a single rescore? That is what we expect users to do when they build a rescore.

@cbuescher
Copy link
Member Author

@nik9000 I think the reason we didn't do this (and other similar things like writing default values even if they haven' been explicitely set by the user) so far is to avoid having different query rendering logic. In this case it would have helped with test coverage (no need for the explicit json tests added with this PR) but in the end the array syntax with one element is just parsed to the same object again. Given that toXContent should only be used in roundtriup tests and for logging I think we can leave that for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Search/Search Search-related issues that do not fall into other categories v5.0.0-alpha3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants