Es failed to remove retention leases – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-8.9

Briefly, this error occurs when Elasticsearch fails to remove retention leases, which are used to retain operations for a certain period of time. This could be due to a network issue, a node failure, or a problem with the underlying storage. To resolve this issue, you can try restarting the Elasticsearch node, checking the network connectivity, or inspecting the health of the underlying storage system. If the problem persists, you may need to manually remove the retention leases using the Elasticsearch API.

This guide will help you check for common problems that cause the log ” es.failed_to_remove_retention_leases ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin.

Log Context

Log “es.failed_to_remove_retention_leases” class name is We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 if (r.isAcknowledged() == false) {
 throw new ElasticsearchException("unfollow request failed to be acknowledged");
 }; 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");
 "failed to remove leader retention lease(s) {} while unfollowing index [{}]; " + "continuing with lifecycle execution";


How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?