@Override
    public Optional<HealthStatus> deflectorHealth(Collection<String> indices) {
        if (indices.isEmpty()) {
            return Optional.of(HealthStatus.Green);
        }

        final Map<String, String> aliasMapping = catApi.aliases();
        final Set<String> mappedIndices = indices
                .stream()
                .map(index -> aliasMapping.getOrDefault(index, index))
                .collect(Collectors.toSet());

        final Set<IndexSummaryResponse> indexSummaries = catApi.indices()
                .stream()
                .filter(indexSummary -> mappedIndices.contains(indexSummary.index()))
                .collect(Collectors.toSet());

        if (indexSummaries.size() < mappedIndices.size()) {
            return Optional.empty();
        }

        return indexSummaries.stream()
                .map(IndexSummaryResponse::health)
                .map(HealthStatus::fromString)
                .min(HealthStatus::compareTo);
    }
@Test
    void testDeflectorHealth() {
        when(catApi.aliases()).thenReturn(Map.of(
                "foo_deflector", "foo_42",
                "bar_deflector", "bar_17",
                "baz_deflector", "baz_23"
        ));

        when(catApi.indices()).thenReturn(List.of(
                new IndexSummaryResponse("foo_42", "", "RED"),
                new IndexSummaryResponse("bar_17", "", "YELLOW"),
                new IndexSummaryResponse("baz_23", "", "GREEN")
        ));

        assertThat(clusterAdapter.deflectorHealth(Set.of("foo_deflector", "bar_deflector", "baz_deflector"))).contains(HealthStatus.Red);
    }