@Override
    public void cleanupAliases(Set<String> indexNames) {
        final SortedSet<String> sortedSet = ImmutableSortedSet
                .orderedBy(new IndexNameComparator(this))
                .addAll(indexNames)
                .build();

        indices.removeAliases(getWriteIndexAlias(), sortedSet.headSet(sortedSet.last()));
    }
@Test
    public void testCleanupAliases() {
        final MongoIndexSet mongoIndexSet = createIndexSet(config);
        mongoIndexSet.cleanupAliases(ImmutableSet.of("graylog_2", "graylog_3", "foobar"));
        verify(indices).removeAliases("graylog_deflector", ImmutableSet.of("graylog_2", "foobar"));
    }