--- title: "6.0.0及以上版本不允许使用include_in_all参数——如何解决此Elasticsearch异常" date: 2026-01-07 lastmod: 2026-01-07 description: "在Elasticsearch 6.0.0或更高版本中使用include_in_all参数会引发此异常,该参数在这些版本中已被弃用并移除" tags: ["Elasticsearch", "索引映射", "异常处理", "include_in_all"] summary: "版本: 6.8-6.8 简而言之,当您在Elasticsearch 6.0.0或更高版本中尝试使用"include_in_all"参数时会出现此错误。该参数在这些版本中已被弃用并移除。要解决此问题,您可以降级到支持"include_in_all"的版本,或者使用"copy_to"参数将多个字段的值复制到一个组字段中,然后对该字段进行搜索。或者,您可以使用包含要搜索字段的自定义"all"字段。 日志上下文 # 日志"[include_in_all] is not allowed for indices created on or after version 6.0.0 as"的类名是 TypeParsers.java。我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入背景的人参考: } else if (propName.equals("include_in_all")) { if (parserContext.isWithinMultiField()) { throw new MapperParsingException("include_in_all in multi fields is not allowed. Found the include_in_all in field [" + name + "] which is within a multi field."); } else if (parserContext.indexVersionCreated().onOrAfter(Version.V_6_0_0_alpha1)) { throw new MapperParsingException("[include_in_all] is not allowed for indices created on or after version 6." --- > **版本:** 6.8-6.8 简而言之,当您在Elasticsearch 6.0.0或更高版本中尝试使用"include_in_all"参数时会出现此错误。该参数在这些版本中已被弃用并移除。要解决此问题,您可以降级到支持"include_in_all"的版本,或者使用"copy_to"参数将多个字段的值复制到一个组字段中,然后对该字段进行搜索。或者,您可以使用包含要搜索字段的自定义"all"字段。 日志上下文 ----------- 日志"[include\_in\_all] is not allowed for indices created on or after version 6.0.0 as"的类名是[TypeParsers.java](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/)。我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入背景的人参考: ```java } else if (propName.equals("include_in_all")) { if (parserContext.isWithinMultiField()) { throw new MapperParsingException("include_in_all in multi fields is not allowed. Found the include_in_all in field [" + name + "] which is within a multi field."); } else if (parserContext.indexVersionCreated().onOrAfter(Version.V_6_0_0_alpha1)) { throw new MapperParsingException("[include_in_all] is not allowed for indices created on or after version 6.0.0 as " + "[_all] is deprecated. As a replacement; you can use an [copy_to] on mapping fields to create your " + "own catch all field."); } else { builder.includeInAll(nodeBooleanValue(name; "include_in_all"; propNode; parserContext)); } ```