Plugin to expose FilterCache details

Hi all,

I don't have a lot of experience with Elasticsearch, let alone with plugin development so I apologize in advance if the question is trivial or my approach is blatantly wrong.

I have been seeing a high number of evictions in a filter cache in one of my ES deployments (1.7). So I was trying to get as much information as possible to understand the nature of those evictions. However, it seems like there are only 2 useful metrics I can get from ES: # of evictions and cache size (please let me know if I've missed other metrics I should look at).

Hence, I've started looking at the available plugins and ultimately decided to build one that would help me to peak into a filter cache. For starters, I want to sample evicted filters, have metrics for the hits, # of documents per cached filter and etc.

Ideally, I would prefer to provide a custom FilterCacheFilterWrapper for WeightedFilterCache but it doesn't seem like it is possible. The closest I was able to get to was extending WeightedFilterCache and using it to bind FilterCache interface. However, I am not sure if it's the best approach since it requires passing an Index to WeightedFilterCache. I can get index from IndicesService but I hope there's a better approach as this seems too hacky.

Thanks!