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

版本: 6.8-7.17

简要来说,当 Elasticsearch 尝试使用索引、类型和 ID 访问文档时,如果该文档不存在,就会出现此错误。这可能是由于文档已被删除、索引未创建或 ID 不正确导致的。要解决此问题,你可以使用带有正确索引和 ID 的 ‘GET’ API 来验证文档是否存在。如果文档不存在,你可能需要重新创建它。如果索引不存在,则需要创建索引。最后,确保你使用的 ID 是正确的。

日志上下文 #

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

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