elastic / curator

Curator: Tending your Elasticsearch indices
Other
3.04k stars 635 forks source link

'indices' missing in stats dict #1670

Closed ttych closed 7 months ago

ttych commented 1 year ago

Hi,

https://github.com/elastic/curator/blob/7beab31e04c0788798d3e6e9e762ec69e6c86011/curator/indexlist.py#L125

In this code, in some situations the indices is not present in the stats dict,

leading to errors like : Failed to complete action: delete_indices. <class 'KeyError'>: 'indices'

Could it be possible to protect this execution by adding a chunk of code like :

if 'indices' not in stats:
    return

Thanks,

Regards,

untergeek commented 1 year ago

Under what conditions is stats not showing indices? I'm curious what conditions are showing no indices in stats. I can't test for it and properly code around it if I can't create/simulate a situation where there are no index stats.

untergeek commented 1 year ago

I ask simply because the absence of stats will cause a different exception in other execution blocks where the stats are expected. I can't simply nope out here and expect the rest of Curator to function as expected. I need to know what's happening so I can fully code around it.

It's either that, or I have to raise exceptions here and everywhere stats are expected but not found.

untergeek commented 7 months ago

With no further updates here, I'm going to close this. Feel free to re-open if you have more details surrounding the how and the why.