Skip to content

Commit

Permalink
Fix backport of #46731 (#52744)
Browse files Browse the repository at this point in the history
This change fixes the incomplete backport of #46731 in 7.x (as of 7.5).
We now check if `max_children` is set on the top level nested sort and fails with an
exception if it's not the case.

Relates #46731
Closes #52202
  • Loading branch information
jimczi committed Feb 26, 2020
1 parent 6532682 commit 7908c9a
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -421,10 +421,6 @@ public SortFieldAndFormat build(QueryShardContext context) throws IOException {
throw new QueryShardException(context,
"max_children is only supported on v6.5.0 or higher");
}
if (nestedSort.getNestedSort() != null && nestedSort.getMaxChildren() != Integer.MAX_VALUE) {
throw new QueryShardException(context,
"max_children is only supported on last level of nested sort");
}
validateMaxChildrenExistOnlyInTopLevelNestedSort(context, nestedSort);
nested = resolveNested(context, nestedSort);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,10 +626,6 @@ public SortFieldAndFormat build(QueryShardContext context) throws IOException {
throw new QueryShardException(context,
"max_children is only supported on v6.5.0 or higher");
}
if (nestedSort.getNestedSort() != null && nestedSort.getMaxChildren() != Integer.MAX_VALUE) {
throw new QueryShardException(context,
"max_children is only supported on last level of nested sort");
}
// new nested sorts takes priority
validateMaxChildrenExistOnlyInTopLevelNestedSort(context, nestedSort);
nested = resolveNested(context, nestedSort);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,6 @@ public SortFieldAndFormat build(QueryShardContext context) throws IOException {
throw new QueryShardException(context,
"max_children is only supported on v6.5.0 or higher");
}
if (nestedSort.getNestedSort() != null && nestedSort.getMaxChildren() != Integer.MAX_VALUE) {
throw new QueryShardException(context,
"max_children is only supported on last level of nested sort");
}
// new nested sorts takes priority
validateMaxChildrenExistOnlyInTopLevelNestedSort(context, nestedSort);
nested = resolveNested(context, nestedSort);
Expand Down

0 comments on commit 7908c9a

Please sign in to comment.