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

版本: 6.8-8.9

简要来说,当您在 Elasticsearch 查询中多次指定 ‘type’ 参数时,会出现此错误。Elasticsearch 要求 ‘type’ 参数在单个查询中必须是唯一的。要解决此问题,请确保在查询中只指定一次 ‘type’ 参数。如果需要搜索多个类型,可以考虑使用通配符或逗号分隔的列表。或者,您可能需要为每个类型运行单独的查询。

日志上下文 #

“Explain TYPE should be specified at most once” 日志的类名是 CommandBuilder.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入了解上下文的人参考:

@Override
public Command visitExplain(ExplainContext ctx) {
    Source source = source(ctx);
    if (ctx.PLAN().size() > 1) {
        throw new ParsingException(source, "Explain TYPE should be specified at most once");
    }
    if (ctx.FORMAT().size() > 1) {
        throw new ParsingException(source, "Explain FORMAT should be specified at most once");
    }
    if (ctx.VERIFY().size() > 1) {