-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Fix double array for sub_searches in toXContent
#96963
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
|
Pinging @elastic/es-search (Team:Search) |
|
Hi @jdconrad, I've created a changelog YAML for you. |
|
@jdconrad since this is an unreleased feature, I don't think I suggest using |
| builder.field(QUERY_FIELD.getPreferredName(), subSearchSourceBuilders.get(0).getQueryBuilder()); | ||
| } else { | ||
| builder.array(SUB_SEARCHES_FIELD.getPreferredName(), subSearchSourceBuilders); | ||
| builder.xContentList(SUB_SEARCHES_FIELD.getPreferredName(), subSearchSourceBuilders); |
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.
TIL about xContentList nice.
benwtrent
left a comment
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.
This should be >non-issue and the changelog removed. This isn't really a bug fix on a released version. Just fixing stuff that hasn't been released yet.
| SearchRequest request = createSearchRequest(); | ||
| if (request.source() != null) { | ||
| request.source().rankBuilder(null); | ||
| request.source().subSearches(new ArrayList<>()); |
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.
We shouldn't do this. It will remove all coverage for when there is a single query. Does this test fail when there is just one subSearch (e.g. just a query?)
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.
Good point! I'll only remove it if size >= 2.
benwtrent
left a comment
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.
![]()
|
@benwtrent Thanks for the review! |
This fixes two bugs:
toXContentwas writing two arrays instead of one array forsub_searchesas part ofSearchSourceBuildersub_searchesfromShardSearchRequestTests.setForceSyntheticSourceCloses #96896
Closes #96910