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

简要来说,当 Elasticsearch 无法获取设置了 includes/excludes 参数的特定类型和 id 的文档时,会出现此错误。这可能是由于类型或 id 不正确,或者 includes/excludes 参数设置不当。要解决此问题,请确保类型和 id 正确且存在于数据库中。同时,检查 includes/excludes 参数的语法和用法。它们应该被正确使用来过滤返回的源文档字段。

版本: 6.8-7.17

日志上下文 #

日志 “Failed to get type [” + type + “] and id [” + id + “] with includes/excludes set” 的类名是 ShardGetService.java. 我们从 Elasticsearch 源代码中提取了以下内容,为那些寻求深入理解上下文的人提供参考:

    sourceAsMap = typeMapTuple.v2();
    sourceAsMap = XContentMapValues.filter(sourceAsMap; fetchSourceContext.includes(); fetchSourceContext.excludes());
    try {
        source = BytesReference.bytes(XContentFactory.contentBuilder(sourceContentType).map(sourceAsMap));
    } catch (IOException e) {
        throw new ElasticsearchException("Failed to get type [" + type + "] and id [" + id + "] with includes/excludes set"; e);
    }
    }  return new GetResult(
        shardId.getIndexName();