--- title: "Max children 仅在 v6.5.0 或更高版本支持 - 如何解决此 Elasticsearch 异常" date: 2026-01-03 lastmod: 2026-01-03 description: "当在低于 6.5.0 的 Elasticsearch 版本上使用 max_children 功能时会出现此错误。本文介绍如何解决该异常。" tags: ["Elasticsearch", "异常处理", "版本兼容", "嵌套排序", "查询异常"] summary: " 版本: 7.16-7.17 简而言之,当你尝试在低于 6.5.0 的 Elasticsearch 版本上使用 “max_children” 功能时,会出现此错误。早期版本不支持此功能。要解决此问题,你可以将 Elasticsearch 升级到 6.5.0 或更高版本,或者如果无法升级,则不要使用 “max_children” 功能。请确保在升级前备份数据,以防数据丢失。 日志上下文 # 日志 “max_children is only supported on v6.5.0 or higher” 的类名是 ScriptSortBuilder.java。 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考: } final Nested nested; if (nestedSort != null) { if (context.indexVersionCreated().before(Version.V_6_5_0) && nestedSort.getMaxChildren() != Integer.MAX_VALUE) { throw new QueryShardException(context; "max_children is only supported on v6.5.0 or higher"); } // new nested sorts takes priority validateMaxChildrenExistOnlyInTopLevelNestedSort(context; nestedSort); nested = resolveNested(context; nestedSort); } else { " --- > **版本:** 7.16-7.17 简而言之,当你尝试在低于 6.5.0 的 Elasticsearch 版本上使用 "max_children" 功能时,会出现此错误。早期版本不支持此功能。要解决此问题,你可以将 Elasticsearch 升级到 6.5.0 或更高版本,或者如果无法升级,则不要使用 "max_children" 功能。请确保在升级前备份数据,以防数据丢失。 日志上下文 ------- 日志 "max\_children is only supported on v6.5.0 or higher" 的类名是 [ScriptSortBuilder.java。](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/) 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考: ```java } final Nested nested; if (nestedSort != null) { if (context.indexVersionCreated().before(Version.V_6_5_0) && nestedSort.getMaxChildren() != Integer.MAX_VALUE) { throw new QueryShardException(context; "max_children is only supported on v6.5.0 or higher"); } // new nested sorts takes priority validateMaxChildrenExistOnlyInTopLevelNestedSort(context; nestedSort); nested = resolveNested(context; nestedSort); } else { ```