--- title: "意外地从只读仓库删除路径 - 如何解决此 Elasticsearch 异常" date: 2026-03-13 lastmod: 2026-03-13 description: "Elasticsearch 中意外地从只读仓库删除路径的错误及其解决方案" tags: ["Elasticsearch", "异常处理", "只读仓库", "快照"] summary: "版本: 6.8-7.2 简而言之,当 Elasticsearch 尝试从已设置为只读的仓库中删除数据时,会发生此错误。这可能是由于权限不正确或配置错误造成的。要解决此问题,您可以更改仓库的权限以允许写入操作,或确保没有对只读仓库执行删除操作。此外,请检查您的 Elasticsearch 配置,确保不会错误地将仓库设置为只读。 日志上下文 # 日志 “unexpectedly deleting [” + path + “] from a readonly repository” 的类名是 FsBlobStore.java. 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入理解的人参考: @Override public void delete(BlobPath path) throws IOException { assert readOnly == false : "should not delete anything from a readonly repository: " + path; //noinspection ConstantConditions in case assertions are disabled if (readOnly) { throw new ElasticsearchException("unexpectedly deleting [" + path + "] from a readonly repository"); } IOUtils." --- > **版本:** 6.8-7.2 简而言之,当 Elasticsearch 尝试从已设置为只读的仓库中删除数据时,会发生此错误。这可能是由于权限不正确或配置错误造成的。要解决此问题,您可以更改仓库的权限以允许写入操作,或确保没有对只读仓库执行删除操作。此外,请检查您的 Elasticsearch 配置,确保不会错误地将仓库设置为只读。 日志上下文 ----------- 日志 "unexpectedly deleting [" + path + "] from a readonly repository" 的类名是 [FsBlobStore.java.](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/) 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入理解的人参考: ```java @Override public void delete(BlobPath path) throws IOException { assert readOnly == false : "should not delete anything from a readonly repository: " + path; //noinspection ConstantConditions in case assertions are disabled if (readOnly) { throw new ElasticsearchException("unexpectedly deleting [" + path + "] from a readonly repository"); } IOUtils.rm(buildPath(path)); } @Override ```