Set<String> toClose = new HashSet<>();
Set<String> toDelete = new HashSet<>();
// Compute things to do
LocalDate now = new LocalDate();
for (ObjectObjectCursor<String, IndexMetaData> it : state.getState().metaData().indices()) {
String index = it.value.getIndex();
Matcher matcher = pattern.matcher(index);
if (matcher.find()) {
LocalDate date = new LocalDate(Integer.parseInt(matcher.group(1)),
Integer.parseInt(matcher.group(2)),
Integer.parseInt(matcher.group(3)));
int daysOld = Days.daysBetween(date, now).getDays();
if (daysOld > 0 && daysOpened > 0 && daysOld > daysOpened) {