diff --git a/opensearch/src/main/java/org/opensearch/sql/opensearch/client/OpenSearchNodeClient.java b/opensearch/src/main/java/org/opensearch/sql/opensearch/client/OpenSearchNodeClient.java index f9715ec1c3..79afd8829b 100644 --- a/opensearch/src/main/java/org/opensearch/sql/opensearch/client/OpenSearchNodeClient.java +++ b/opensearch/src/main/java/org/opensearch/sql/opensearch/client/OpenSearchNodeClient.java @@ -151,7 +151,7 @@ public List indices() { .setLocal(true) .get(); final Stream aliasStream = - ImmutableList.copyOf(indexResponse.aliases().valuesIt()).stream() + ImmutableList.copyOf(indexResponse.aliases().values()).stream() .flatMap(Collection::stream).map(AliasMetadata::alias); return Stream.concat(Arrays.stream(indexResponse.getIndices()), aliasStream) diff --git a/opensearch/src/test/java/org/opensearch/sql/opensearch/client/OpenSearchNodeClientTest.java b/opensearch/src/test/java/org/opensearch/sql/opensearch/client/OpenSearchNodeClientTest.java index d9e42d17f5..2de0214baa 100644 --- a/opensearch/src/test/java/org/opensearch/sql/opensearch/client/OpenSearchNodeClientTest.java +++ b/opensearch/src/test/java/org/opensearch/sql/opensearch/client/OpenSearchNodeClientTest.java @@ -399,9 +399,7 @@ void cleanup_rethrows_exception() { @Test void get_indices() { AliasMetadata aliasMetadata = mock(AliasMetadata.class); - ImmutableOpenMap.Builder> builder = ImmutableOpenMap.builder(); - builder.fPut("index", Arrays.asList(aliasMetadata)); - final ImmutableOpenMap> openMap = builder.build(); + final var openMap = Map.of("index", List.of(aliasMetadata)); when(aliasMetadata.alias()).thenReturn("index_alias"); when(nodeClient.admin().indices() .prepareGetIndex()