@Subscribe
    @AllowConcurrentEvents
    public void handleIndexClosing(IndicesClosedEvent event) {
        for (String index : event.indices()) {
            if (!indexSetRegistry.isManagedIndex(index)) {
                LOG.debug("Not handling closed index <{}> because it's not managed by any index set.", index);
                continue;
            }
            LOG.debug("Index \"{}\" has been closed. Removing index range.", index);
            if (remove(index)) {
                auditEventSender.success(AuditActor.system(nodeId), ES_INDEX_RANGE_DELETE, ImmutableMap.of("index_name", index));
            }
        }
    }
@Test
    @MongoDBFixtures("MongoIndexRangeServiceTest.json")
    public void testHandleIndexClosing() throws Exception {
        when(indexSetRegistry.isManagedIndex("graylog_1")).thenReturn(true);

        assertThat(indexRangeService.findAll()).hasSize(2);

        localEventBus.post(IndicesClosedEvent.create(Collections.singleton("graylog_1")));

        assertThat(indexRangeService.findAll()).hasSize(1);
    }