diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/filter/resident/ResidentFilterCache.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/filter/resident/ResidentFilterCache.java index edda64fc413..56a04e84b3c 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/filter/resident/ResidentFilterCache.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/filter/resident/ResidentFilterCache.java @@ -62,6 +62,7 @@ public class ResidentFilterCache extends AbstractConcurrentMapFilterCache implem if (expire != null) { mapMaker.expireAfterAccess(expire.nanos(), TimeUnit.NANOSECONDS); } + mapMaker.evictionListener(this); return mapMaker.makeMap(); } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/filter/soft/SoftFilterCache.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/filter/soft/SoftFilterCache.java index d036daf44b0..f6818d245b9 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/filter/soft/SoftFilterCache.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/filter/soft/SoftFilterCache.java @@ -63,6 +63,7 @@ public class SoftFilterCache extends AbstractConcurrentMapFilterCache implements if (expire != null) { mapMaker.expireAfterAccess(expire.nanos(), TimeUnit.NANOSECONDS); } + mapMaker.evictionListener(this); return mapMaker.makeMap(); }