Skip to content

Commit 7908c9a

Browse files
committed
Fix backport of #46731 (#52744)
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
1 parent 6532682 commit 7908c9a

File tree

3 files changed

+0
-12
lines changed

3 files changed

+0
-12
lines changed

server/src/main/java/org/elasticsearch/search/sort/FieldSortBuilder.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,10 +421,6 @@ public SortFieldAndFormat build(QueryShardContext context) throws IOException {
421421
throw new QueryShardException(context,
422422
"max_children is only supported on v6.5.0 or higher");
423423
}
424-
if (nestedSort.getNestedSort() != null && nestedSort.getMaxChildren() != Integer.MAX_VALUE) {
425-
throw new QueryShardException(context,
426-
"max_children is only supported on last level of nested sort");
427-
}
428424
validateMaxChildrenExistOnlyInTopLevelNestedSort(context, nestedSort);
429425
nested = resolveNested(context, nestedSort);
430426
} else {

server/src/main/java/org/elasticsearch/search/sort/GeoDistanceSortBuilder.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -626,10 +626,6 @@ public SortFieldAndFormat build(QueryShardContext context) throws IOException {
626626
throw new QueryShardException(context,
627627
"max_children is only supported on v6.5.0 or higher");
628628
}
629-
if (nestedSort.getNestedSort() != null && nestedSort.getMaxChildren() != Integer.MAX_VALUE) {
630-
throw new QueryShardException(context,
631-
"max_children is only supported on last level of nested sort");
632-
}
633629
// new nested sorts takes priority
634630
validateMaxChildrenExistOnlyInTopLevelNestedSort(context, nestedSort);
635631
nested = resolveNested(context, nestedSort);

server/src/main/java/org/elasticsearch/search/sort/ScriptSortBuilder.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,6 @@ public SortFieldAndFormat build(QueryShardContext context) throws IOException {
321321
throw new QueryShardException(context,
322322
"max_children is only supported on v6.5.0 or higher");
323323
}
324-
if (nestedSort.getNestedSort() != null && nestedSort.getMaxChildren() != Integer.MAX_VALUE) {
325-
throw new QueryShardException(context,
326-
"max_children is only supported on last level of nested sort");
327-
}
328324
// new nested sorts takes priority
329325
validateMaxChildrenExistOnlyInTopLevelNestedSort(context, nestedSort);
330326
nested = resolveNested(context, nestedSort);

0 commit comments

Comments
 (0)