📣 极限科技诚招搜索运维工程师(Elasticsearch/Easysearch)- 全职/北京 👉 : 立即申请加入

版本: 7.16-8.9

简而言之,当在 Elasticsearch 的非顶层嵌套排序中使用 ‘max_children’ 参数时会出现此错误。‘max_children’ 参数仅允许在嵌套排序的顶层使用。要解决此问题,你应该确保 ‘max_children’ 仅在嵌套排序的顶层使用。如果它在更深层级中使用,你应该重构查询以符合此要求。或者,如果可行且能简化查询,可以考虑重组数据结构。

日志上下文 #

日志 “max_children is only supported on top level of nested sort” 的类名是 FieldSortBuilder.java。 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考:

* 如果 max children 不位于顶层嵌套排序则抛出异常
 */
 static void validateMaxChildrenExistOnlyInTopLevelNestedSort(SearchExecutionContext context; NestedSortBuilder nestedSort) {
 for (NestedSortBuilder child = nestedSort.getNestedSort(); child != null; child = child.getNestedSort()) {
 if (child.getMaxChildren() != Integer.MAX_VALUE) {
 throw new QueryShardException(context; "max_children is only supported on top level of nested sort");
 }
 }
 }  /**