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

版本: 8-8.9

简要来说,当 Elasticsearch 尝试使用特定的索引和 ID 检索文档,但该文档在指定索引中不存在时,就会出现此错误。这可能是由于文档被删除、索引不存在或 ID 不正确造成的。要解决此问题,您可以验证索引和文档 ID 的存在性。如果索引或文档 ID 不正确,请予以更正。如果文档已被删除,您可能需要重新创建它,或者在可用的情况下从备份中恢复它。

日志上下文 #

日志 “Document not found [” + index + “]/[” + id + “]” 类名是 RestGetSourceAction.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考:

private static void checkResource(final GetResponse response) {
 final String index = response.getIndex();
 final String id = response.getId();  if (response.isExists() == false) {
 throw new ResourceNotFoundException("Document not found [" + index + "]/[" + id + "]");
 } else if (response.isSourceEmpty()) {
 throw new ResourceNotFoundException("Source not found [" + index + "]/[" + id + "]");
 }
 }
 }