--- title: "Elasticsearch 无法删除保留租约 – 如何解决此 Elasticsearch 异常" date: 2026-02-28 lastmod: 2026-02-28 description: "当 Elasticsearch 无法删除保留租约时出现的错误及解决方案。" tags: ["Elasticsearch", "保留租约", "索引跟随", "异常处理"] summary: " 版本: 6.8-8.9 简要来说,当 Elasticsearch 无法删除保留租约时会出现此错误。保留租约用于在一定时间内保留操作。这可能是由于网络问题、节点故障或底层存储问题造成的。要解决此问题,可以尝试重启 Elasticsearch 节点、检查网络连接或检查底层存储系统的运行状况。如果问题仍然存在,您可能需要使用 Elasticsearch API 手动删除保留租约。 日志上下文 # 日志 “es.failed_to_remove_retention_leases” 的类名是 UnfollowFollowerIndexStep.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人使用: if (r.isAcknowledged() == false) { throw new ElasticsearchException("unfollow request failed to be acknowledged"); } listener.onResponse(null); }, exception -> { if (exception instanceof ElasticsearchException e && e.getMetadata("es.failed_to_remove_retention_leases") != null) { List<String> leasesNotRemoved = e.getMetadata("es.failed_to_remove_retention_leases"); logger.debug( "failed to remove leader retention lease(s) {} while unfollowing index [{}]; " + "continuing with lifecycle execution", leasesNotRemoved, followerIndex " --- > **版本:** 6.8-8.9 简要来说,当 Elasticsearch 无法删除保留租约时会出现此错误。保留租约用于在一定时间内保留操作。这可能是由于网络问题、节点故障或底层存储问题造成的。要解决此问题,可以尝试重启 Elasticsearch 节点、检查网络连接或检查底层存储系统的运行状况。如果问题仍然存在,您可能需要使用 Elasticsearch API 手动删除保留租约。 日志上下文 ----------- 日志 “es.failed\_to\_remove\_retention\_leases” 的类名是 [UnfollowFollowerIndexStep.java](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/)。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人使用: ```java if (r.isAcknowledged() == false) { throw new ElasticsearchException("unfollow request failed to be acknowledged"); } listener.onResponse(null); }, exception -> { if (exception instanceof ElasticsearchException e && e.getMetadata("es.failed_to_remove_retention_leases") != null) { List leasesNotRemoved = e.getMetadata("es.failed_to_remove_retention_leases"); logger.debug( "failed to remove leader retention lease(s) {} while unfollowing index [{}]; " + "continuing with lifecycle execution", leasesNotRemoved, followerIndex ```