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
This commit is contained in:
parent
37be695d5c
commit
a73ad248e8
|
@ -476,10 +476,6 @@ public class FieldSortBuilder extends SortBuilder<FieldSortBuilder> {
|
|||
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);
|
||||
return resolveNested(context, nestedSort);
|
||||
}
|
||||
|
|
|
@ -605,7 +605,7 @@ public class GeoDistanceSortBuilder extends SortBuilder<GeoDistanceSortBuilder>
|
|||
IndexGeoPointFieldData geoIndexFieldData = fieldData(context);
|
||||
Nested nested = nested(context);
|
||||
|
||||
// TODO implement the single point optimization above
|
||||
// TODO implement the single point optimization above
|
||||
|
||||
return comparatorSource(localPoints, localSortMode, geoIndexFieldData, nested)
|
||||
.newBucketedSort(context.bigArrays(), order, DocValueFormat.RAW);
|
||||
|
@ -670,10 +670,6 @@ public class GeoDistanceSortBuilder extends SortBuilder<GeoDistanceSortBuilder>
|
|||
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);
|
||||
return resolveNested(context, nestedSort);
|
||||
}
|
||||
|
|
|
@ -332,10 +332,6 @@ public class ScriptSortBuilder extends SortBuilder<ScriptSortBuilder> {
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue