Browse Source

Get index includes parent data stream for backing indices (#56022)

Dan Hermann 5 years ago
parent
commit
117055d49e

+ 26 - 4
client/rest-high-level/src/main/java/org/elasticsearch/client/indices/GetIndexResponse.java

@@ -47,13 +47,15 @@ public class GetIndexResponse {
     private Map<String, List<AliasMetadata>> aliases;
     private Map<String, Settings> settings;
     private Map<String, Settings> defaultSettings;
+    private Map<String, String> dataStreams;
     private String[] indices;
 
     GetIndexResponse(String[] indices,
                      Map<String, MappingMetadata> mappings,
                      Map<String, List<AliasMetadata>> aliases,
                      Map<String, Settings> settings,
-                     Map<String, Settings> defaultSettings) {
+                     Map<String, Settings> defaultSettings,
+                     Map<String, String> dataStreams) {
         this.indices = indices;
         // to have deterministic order
         Arrays.sort(indices);
@@ -69,6 +71,9 @@ public class GetIndexResponse {
         if (defaultSettings != null) {
             this.defaultSettings = defaultSettings;
         }
+        if (dataStreams != null) {
+            this.dataStreams = dataStreams;
+        }
     }
 
     public String[] getIndices() {
@@ -99,6 +104,10 @@ public class GetIndexResponse {
         return settings;
     }
 
+    public Map<String, String> getDataStreams() {
+        return dataStreams;
+    }
+
     /**
      * Returns the string value for the specified index and setting. If the includeDefaults flag was not set or set to
      * false on the {@link GetIndexRequest}, this method will only return a value where the setting was explicitly set
@@ -142,6 +151,7 @@ public class GetIndexResponse {
         MappingMetadata indexMappings = null;
         Settings indexSettings = null;
         Settings indexDefaultSettings = null;
+        String dataStream = null;
         // We start at START_OBJECT since fromXContent ensures that
         while (parser.nextToken() != Token.END_OBJECT) {
             ensureExpectedToken(Token.FIELD_NAME, parser.currentToken(), parser::getTokenLocation);
@@ -163,11 +173,16 @@ public class GetIndexResponse {
                     default:
                         parser.skipChildren();
                 }
+            } else if (parser.currentToken() == Token.VALUE_STRING) {
+                if (parser.currentName().equals("data_stream")) {
+                    dataStream = parser.text();
+                }
+                parser.skipChildren();
             } else if (parser.currentToken() == Token.START_ARRAY) {
                 parser.skipChildren();
             }
         }
-        return new IndexEntry(indexAliases, indexMappings, indexSettings, indexDefaultSettings);
+        return new IndexEntry(indexAliases, indexMappings, indexSettings, indexDefaultSettings, dataStream);
     }
 
     // This is just an internal container to make stuff easier for returning
@@ -176,11 +191,14 @@ public class GetIndexResponse {
         MappingMetadata indexMappings;
         Settings indexSettings = Settings.EMPTY;
         Settings indexDefaultSettings = Settings.EMPTY;
-        IndexEntry(List<AliasMetadata> indexAliases, MappingMetadata indexMappings, Settings indexSettings, Settings indexDefaultSettings) {
+        String dataStream;
+        IndexEntry(List<AliasMetadata> indexAliases, MappingMetadata indexMappings, Settings indexSettings, Settings indexDefaultSettings,
+                   String dataStream) {
             if (indexAliases != null) this.indexAliases = indexAliases;
             if (indexMappings != null) this.indexMappings = indexMappings;
             if (indexSettings != null) this.indexSettings = indexSettings;
             if (indexDefaultSettings != null) this.indexDefaultSettings = indexDefaultSettings;
+            if (dataStream != null) this.dataStream = dataStream;
         }
     }
 
@@ -189,6 +207,7 @@ public class GetIndexResponse {
         Map<String, MappingMetadata> mappings = new HashMap<>();
         Map<String, Settings> settings = new HashMap<>();
         Map<String, Settings> defaultSettings = new HashMap<>();
+        Map<String, String> dataStreams = new HashMap<>();
         List<String> indices = new ArrayList<>();
 
         if (parser.currentToken() == null) {
@@ -211,12 +230,15 @@ public class GetIndexResponse {
                 if (indexEntry.indexDefaultSettings.isEmpty() == false) {
                     defaultSettings.put(indexName, indexEntry.indexDefaultSettings);
                 }
+                if (indexEntry.dataStream != null) {
+                    dataStreams.put(indexName, indexEntry.dataStream);
+                }
             } else if (parser.currentToken() == Token.START_ARRAY) {
                 parser.skipChildren();
             } else {
                 parser.nextToken();
             }
         }
-        return new GetIndexResponse(indices.toArray(new String[0]), mappings, aliases, settings, defaultSettings);
+        return new GetIndexResponse(indices.toArray(new String[0]), mappings, aliases, settings, defaultSettings, dataStreams);
     }
 }

+ 8 - 1
client/rest-high-level/src/test/java/org/elasticsearch/client/indices/GetIndexResponseTests.java

@@ -38,6 +38,7 @@ import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Objects;
 
@@ -51,6 +52,7 @@ public class GetIndexResponseTests extends AbstractResponseTestCase<org.elastics
         ImmutableOpenMap.Builder<String, List<AliasMetadata>> aliases = ImmutableOpenMap.builder();
         ImmutableOpenMap.Builder<String, Settings> settings = ImmutableOpenMap.builder();
         ImmutableOpenMap.Builder<String, Settings> defaultSettings = ImmutableOpenMap.builder();
+        ImmutableOpenMap.Builder<String, String> dataStreams = ImmutableOpenMap.builder();
         IndexScopedSettings indexScopedSettings = IndexScopedSettings.DEFAULT_SCOPED_SETTINGS;
         boolean includeDefaults = randomBoolean();
         for (String index: indices) {
@@ -71,9 +73,13 @@ public class GetIndexResponseTests extends AbstractResponseTestCase<org.elastics
             if (includeDefaults) {
                 defaultSettings.put(index, indexScopedSettings.diff(settings.get(index), Settings.EMPTY));
             }
+
+            if (randomBoolean()) {
+                dataStreams.put(index, randomAlphaOfLength(5).toLowerCase(Locale.ROOT));
+            }
         }
         return new org.elasticsearch.action.admin.indices.get.GetIndexResponse(indices,
-            mappings.build(), aliases.build(), settings.build(), defaultSettings.build());
+            mappings.build(), aliases.build(), settings.build(), defaultSettings.build(), dataStreams.build());
     }
 
     @Override
@@ -89,6 +95,7 @@ public class GetIndexResponseTests extends AbstractResponseTestCase<org.elastics
         assertMapEquals(serverTestInstance.getSettings(), clientInstance.getSettings());
         assertMapEquals(serverTestInstance.defaultSettings(), clientInstance.getDefaultSettings());
         assertMapEquals(serverTestInstance.getAliases(), clientInstance.getAliases());
+        assertMapEquals(serverTestInstance.getDataStreams(), clientInstance.getDataStreams());
     }
 
     private static MappingMetadata createMappingsForIndex() {

+ 35 - 0
rest-api-spec/src/main/resources/rest-api-spec/test/indices.get/20_backing_indices.yml

@@ -0,0 +1,35 @@
+---
+"Get backing indices for data stream":
+  - skip:
+      version: " - 7.99.99"
+      reason:  "enable in 7.8+ after backporting"
+
+  - do:
+      indices.create_data_stream:
+        name: data-stream1
+        body:
+          timestamp_field: "@timestamp"
+  - is_true: acknowledged
+
+  - do:
+      indices.create:
+        index: test_index
+        body:
+          settings:
+            number_of_shards:   1
+            number_of_replicas: 1
+
+  - do:
+      indices.get:
+        index: ['data-stream1-000001', 'test_index']
+
+  - is_true: data-stream1-000001.settings
+  - is_true: data-stream1-000001.data_stream
+  - match: { data-stream1-000001.data_stream: data-stream1 }
+  - is_true: test_index.settings
+  - is_false: test_index.data_stream
+
+  - do:
+      indices.delete_data_stream:
+        name: data-stream1
+  - is_true: acknowledged

+ 39 - 3
server/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexResponse.java

@@ -49,13 +49,15 @@ public class GetIndexResponse extends ActionResponse implements ToXContentObject
     private ImmutableOpenMap<String, List<AliasMetadata>> aliases = ImmutableOpenMap.of();
     private ImmutableOpenMap<String, Settings> settings = ImmutableOpenMap.of();
     private ImmutableOpenMap<String, Settings> defaultSettings = ImmutableOpenMap.of();
+    private ImmutableOpenMap<String, String> dataStreams = ImmutableOpenMap.of();
     private String[] indices;
 
     public GetIndexResponse(String[] indices,
                      ImmutableOpenMap<String, MappingMetadata> mappings,
                      ImmutableOpenMap<String, List<AliasMetadata>> aliases,
                      ImmutableOpenMap<String, Settings> settings,
-                     ImmutableOpenMap<String, Settings> defaultSettings) {
+                     ImmutableOpenMap<String, Settings> defaultSettings,
+                     ImmutableOpenMap<String, String> dataStreams) {
         this.indices = indices;
         // to have deterministic order
         Arrays.sort(indices);
@@ -71,6 +73,9 @@ public class GetIndexResponse extends ActionResponse implements ToXContentObject
         if (defaultSettings != null) {
             this.defaultSettings = defaultSettings;
         }
+        if (dataStreams != null) {
+            this.dataStreams = dataStreams;
+        }
     }
 
     GetIndexResponse(StreamInput in) throws IOException {
@@ -126,6 +131,15 @@ public class GetIndexResponse extends ActionResponse implements ToXContentObject
             defaultSettingsMapBuilder.put(in.readString(), Settings.readSettingsFromStream(in));
         }
         defaultSettings = defaultSettingsMapBuilder.build();
+
+        if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
+            ImmutableOpenMap.Builder<String, String> dataStreamsMapBuilder = ImmutableOpenMap.builder();
+            int dataStreamsSize = in.readVInt();
+            for (int i = 0; i < dataStreamsSize; i++) {
+                dataStreamsMapBuilder.put(in.readString(), in.readOptionalString());
+            }
+            dataStreams = dataStreamsMapBuilder.build();
+        }
     }
 
     public String[] indices() {
@@ -156,6 +170,14 @@ public class GetIndexResponse extends ActionResponse implements ToXContentObject
         return settings;
     }
 
+    public ImmutableOpenMap<String, String> dataStreams() {
+        return dataStreams;
+    }
+
+    public ImmutableOpenMap<String, String> getDataStreams() {
+        return dataStreams();
+    }
+
     /**
      * If the originating {@link GetIndexRequest} object was configured to include
      * defaults, this will contain a mapping of index name to {@link Settings} objects.
@@ -233,6 +255,13 @@ public class GetIndexResponse extends ActionResponse implements ToXContentObject
             out.writeString(indexEntry.key);
             Settings.writeSettingsToStream(indexEntry.value, out);
         }
+        if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
+            out.writeVInt(dataStreams.size());
+            for (ObjectObjectCursor<String, String> indexEntry : dataStreams) {
+                out.writeString(indexEntry.key);
+                out.writeOptionalString(indexEntry.value);
+            }
+        }
     }
 
     @Override
@@ -271,6 +300,11 @@ public class GetIndexResponse extends ActionResponse implements ToXContentObject
                         defaultIndexSettings.toXContent(builder, params);
                         builder.endObject();
                     }
+
+                    String dataStream = dataStreams.get(index);
+                    if (dataStream != null) {
+                        builder.field("data_stream", dataStream);
+                    }
                 }
                 builder.endObject();
             }
@@ -293,7 +327,8 @@ public class GetIndexResponse extends ActionResponse implements ToXContentObject
             Objects.equals(aliases, that.aliases) &&
             Objects.equals(mappings, that.mappings) &&
             Objects.equals(settings, that.settings) &&
-            Objects.equals(defaultSettings, that.defaultSettings);
+            Objects.equals(defaultSettings, that.defaultSettings) &&
+            Objects.equals(dataStreams, that.dataStreams);
     }
 
     @Override
@@ -304,7 +339,8 @@ public class GetIndexResponse extends ActionResponse implements ToXContentObject
                 aliases,
                 mappings,
                 settings,
-                defaultSettings
+                defaultSettings,
+                dataStreams
             );
     }
 }

+ 6 - 1
server/src/main/java/org/elasticsearch/action/admin/indices/get/TransportGetIndexAction.java

@@ -44,6 +44,8 @@ import org.elasticsearch.transport.TransportService;
 
 import java.io.IOException;
 import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.StreamSupport;
 
 /**
  * Get index action.
@@ -90,6 +92,9 @@ public class TransportGetIndexAction extends TransportClusterInfoAction<GetIndex
         ImmutableOpenMap<String, List<AliasMetadata>> aliasesResult = ImmutableOpenMap.of();
         ImmutableOpenMap<String, Settings> settings = ImmutableOpenMap.of();
         ImmutableOpenMap<String, Settings> defaultSettings = ImmutableOpenMap.of();
+        ImmutableOpenMap<String, String> dataStreams = ImmutableOpenMap.<String, String>builder()
+            .putAll(StreamSupport.stream(state.metadata().findDataStreams(concreteIndices).spliterator(), false)
+                .collect(Collectors.toMap(k -> k.key, v -> v.value.getName()))).build();
         Feature[] features = request.features();
         boolean doneAliases = false;
         boolean doneMappings = false;
@@ -140,7 +145,7 @@ public class TransportGetIndexAction extends TransportClusterInfoAction<GetIndex
             }
         }
         listener.onResponse(
-            new GetIndexResponse(concreteIndices, mappingsResult, aliasesResult, settings, defaultSettings)
+            new GetIndexResponse(concreteIndices, mappingsResult, aliasesResult, settings, defaultSettings, dataStreams)
         );
     }
 }

+ 18 - 0
server/src/main/java/org/elasticsearch/cluster/metadata/Metadata.java

@@ -401,6 +401,24 @@ public class Metadata implements Iterable<IndexMetadata>, Diffable<Metadata>, To
         return indexMapBuilder.build();
     }
 
+    /**
+     * Finds the parent data streams, if any, for the specified concrete indices.
+     */
+    public ImmutableOpenMap<String, IndexAbstraction.DataStream> findDataStreams(String[] concreteIndices) {
+        assert concreteIndices != null;
+        final ImmutableOpenMap.Builder<String, IndexAbstraction.DataStream> builder = ImmutableOpenMap.builder();
+        final SortedMap<String, IndexAbstraction> lookup = getIndicesLookup();
+        for (String indexName : concreteIndices) {
+            IndexAbstraction index = lookup.get(indexName);
+            assert index != null;
+            assert index.getType() == IndexAbstraction.Type.CONCRETE_INDEX;
+            if (index.getParentDataStream() != null) {
+                builder.put(indexName, index.getParentDataStream());
+            }
+        }
+        return builder.build();
+    }
+
     @SuppressWarnings("unchecked")
     private static MappingMetadata filterFields(MappingMetadata mappingMetadata, Predicate<String> fieldPredicate) {
         if (mappingMetadata == null) {

+ 7 - 1
server/src/test/java/org/elasticsearch/action/admin/indices/get/GetIndexResponseTests.java

@@ -35,6 +35,7 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
+import java.util.Locale;
 
 public class GetIndexResponseTests extends AbstractWireSerializingTestCase<GetIndexResponse> {
 
@@ -50,6 +51,7 @@ public class GetIndexResponseTests extends AbstractWireSerializingTestCase<GetIn
         ImmutableOpenMap.Builder<String, List<AliasMetadata>> aliases = ImmutableOpenMap.builder();
         ImmutableOpenMap.Builder<String, Settings> settings = ImmutableOpenMap.builder();
         ImmutableOpenMap.Builder<String, Settings> defaultSettings = ImmutableOpenMap.builder();
+        ImmutableOpenMap.Builder<String, String> dataStreams = ImmutableOpenMap.builder();
         IndexScopedSettings indexScopedSettings = IndexScopedSettings.DEFAULT_SCOPED_SETTINGS;
         boolean includeDefaults = randomBoolean();
         for (String index: indices) {
@@ -70,9 +72,13 @@ public class GetIndexResponseTests extends AbstractWireSerializingTestCase<GetIn
             if (includeDefaults) {
                 defaultSettings.put(index, indexScopedSettings.diff(settings.get(index), Settings.EMPTY));
             }
+
+            if (randomBoolean()) {
+                dataStreams.put(index, randomAlphaOfLength(5).toLowerCase(Locale.ROOT));
+            }
         }
         return new GetIndexResponse(
-            indices, mappings.build(), aliases.build(), settings.build(), defaultSettings.build()
+            indices, mappings.build(), aliases.build(), settings.build(), defaultSettings.build(), dataStreams.build()
         );
     }
 }

+ 69 - 35
server/src/test/java/org/elasticsearch/cluster/metadata/MetadataTests.java

@@ -52,6 +52,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.SortedMap;
+import java.util.stream.Collectors;
 
 import static org.elasticsearch.cluster.DataStreamTestHelper.createBackingIndex;
 import static org.elasticsearch.cluster.DataStreamTestHelper.createFirstBackingIndex;
@@ -137,6 +138,23 @@ public class MetadataTests extends ESTestCase {
         assertThat(aliases.get(0).alias(), equalTo("alias2"));
     }
 
+    public void testFindDataStreams() {
+        final int numIndices = randomIntBetween(2, 5);
+        final int numBackingIndices = randomIntBetween(2, 5);
+        final String dataStreamName = "my-data-stream";
+        CreateIndexResult result = createIndices(numIndices, numBackingIndices, dataStreamName);
+
+        List<Index> allIndices = new ArrayList<>(result.indices);
+        allIndices.addAll(result.backingIndices);
+        String[] concreteIndices = allIndices.stream().map(Index::getName).collect(Collectors.toList()).toArray(new String[]{});
+        ImmutableOpenMap<String, IndexAbstraction.DataStream> dataStreams = result.metadata.findDataStreams(concreteIndices);
+        assertThat(dataStreams.size(), equalTo(numBackingIndices));
+        for (Index backingIndex : result.backingIndices) {
+            assertThat(dataStreams.containsKey(backingIndex.getName()), is(true));
+            assertThat(dataStreams.get(backingIndex.getName()).getName(), equalTo(dataStreamName));
+        }
+    }
+
     public void testFindAliasWithExclusionAndOverride() {
         Metadata metadata = Metadata.builder().put(
             IndexMetadata.builder("index")
@@ -1032,47 +1050,18 @@ public class MetadataTests extends ESTestCase {
     }
 
     public void testIndicesLookupRecordsDataStreamForBackingIndices() {
-        // create some indices that do not back a data stream
-        final List<Index> indices = new ArrayList<>();
         final int numIndices = randomIntBetween(2, 5);
-        int lastIndexNum = randomIntBetween(9, 50);
-        Metadata.Builder b = Metadata.builder();
-        for (int k = 1; k <= numIndices; k++) {
-            IndexMetadata im = IndexMetadata.builder(DataStream.getBackingIndexName("index", lastIndexNum))
-                .settings(settings(Version.CURRENT))
-                .numberOfShards(1)
-                .numberOfReplicas(1)
-                .build();
-            b.put(im, false);
-            indices.add(im.getIndex());
-            lastIndexNum = randomIntBetween(lastIndexNum + 1, lastIndexNum + 50);
-        }
-
-        // create some backing indices for a data stream
-        final String dataStreamName = "my-data-stream";
-        final List<Index> backingIndices = new ArrayList<>();
         final int numBackingIndices = randomIntBetween(2, 5);
-        int lastBackingIndexNum = 0;
-        for (int k = 1; k <= numBackingIndices; k++) {
-            lastBackingIndexNum = randomIntBetween(lastBackingIndexNum + 1, lastBackingIndexNum + 50);
-            IndexMetadata im = IndexMetadata.builder(DataStream.getBackingIndexName(dataStreamName, lastBackingIndexNum))
-                .settings(settings(Version.CURRENT))
-                .numberOfShards(1)
-                .numberOfReplicas(1)
-                .build();
-            b.put(im, false);
-            backingIndices.add(im.getIndex());
-        }
-        b.put(new DataStream(dataStreamName, "ts", backingIndices, lastBackingIndexNum));
-        Metadata metadata = b.build();
+        final String dataStreamName = "my-data-stream";
+        CreateIndexResult result = createIndices(numIndices, numBackingIndices, dataStreamName);
 
-        SortedMap<String, IndexAbstraction> indicesLookup = metadata.getIndicesLookup();
-        assertThat(indicesLookup.size(), equalTo(indices.size() + backingIndices.size() + 1));
-        for (Index index : indices) {
+        SortedMap<String, IndexAbstraction> indicesLookup = result.metadata.getIndicesLookup();
+        assertThat(indicesLookup.size(), equalTo(result.indices.size() + result.backingIndices.size() + 1));
+        for (Index index : result.indices) {
             assertTrue(indicesLookup.containsKey(index.getName()));
             assertNull(indicesLookup.get(index.getName()).getParentDataStream());
         }
-        for (Index index : backingIndices) {
+        for (Index index : result.backingIndices) {
             assertTrue(indicesLookup.containsKey(index.getName()));
             assertNotNull(indicesLookup.get(index.getName()).getParentDataStream());
             assertThat(indicesLookup.get(index.getName()).getParentDataStream().getName(), equalTo(dataStreamName));
@@ -1119,4 +1108,49 @@ public class MetadataTests extends ESTestCase {
 
         return md.build();
     }
+
+    private static CreateIndexResult createIndices(int numIndices, int numBackingIndices, String dataStreamName) {
+        // create some indices that do not back a data stream
+        final List<Index> indices = new ArrayList<>();
+        int lastIndexNum = randomIntBetween(9, 50);
+        Metadata.Builder b = Metadata.builder();
+        for (int k = 1; k <= numIndices; k++) {
+            IndexMetadata im = IndexMetadata.builder(DataStream.getBackingIndexName("index", lastIndexNum))
+                .settings(settings(Version.CURRENT))
+                .numberOfShards(1)
+                .numberOfReplicas(1)
+                .build();
+            b.put(im, false);
+            indices.add(im.getIndex());
+            lastIndexNum = randomIntBetween(lastIndexNum + 1, lastIndexNum + 50);
+        }
+
+        // create some backing indices for a data stream
+        final List<Index> backingIndices = new ArrayList<>();
+        int lastBackingIndexNum = 0;
+        for (int k = 1; k <= numBackingIndices; k++) {
+            lastBackingIndexNum = randomIntBetween(lastBackingIndexNum + 1, lastBackingIndexNum + 50);
+            IndexMetadata im = IndexMetadata.builder(DataStream.getBackingIndexName(dataStreamName, lastBackingIndexNum))
+                .settings(settings(Version.CURRENT))
+                .numberOfShards(1)
+                .numberOfReplicas(1)
+                .build();
+            b.put(im, false);
+            backingIndices.add(im.getIndex());
+        }
+        b.put(new DataStream(dataStreamName, "ts", backingIndices, lastBackingIndexNum));
+        return new CreateIndexResult(indices, backingIndices, b.build());
+    }
+
+    private static class CreateIndexResult {
+        final List<Index> indices;
+        final List<Index> backingIndices;
+        final Metadata metadata;
+
+        CreateIndexResult(List<Index> indices, List<Index> backingIndices, Metadata metadata) {
+            this.indices = indices;
+            this.backingIndices = backingIndices;
+            this.metadata = metadata;
+        }
+    }
 }

+ 4 - 4
x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/dataframe/DestinationIndexTests.java

@@ -254,8 +254,8 @@ public class DestinationIndexTests extends ESTestCase {
         ImmutableOpenMap.Builder<String, MappingMetadata> mappings = ImmutableOpenMap.builder();
         mappings.put("", new MappingMetadata("_doc", Map.of("properties", properties)));
         GetIndexResponse getIndexResponse =
-            new GetIndexResponse(
-                new String[] { DEST_INDEX }, mappings.build(), ImmutableOpenMap.of(), ImmutableOpenMap.of(), ImmutableOpenMap.of());
+            new GetIndexResponse(new String[] { DEST_INDEX }, mappings.build(), ImmutableOpenMap.of(), ImmutableOpenMap.of(),
+                ImmutableOpenMap.of(), ImmutableOpenMap.of());
 
         ArgumentCaptor<PutMappingRequest> putMappingRequestCaptor = ArgumentCaptor.forClass(PutMappingRequest.class);
 
@@ -324,8 +324,8 @@ public class DestinationIndexTests extends ESTestCase {
         ImmutableOpenMap.Builder<String, MappingMetadata> mappings = ImmutableOpenMap.builder();
         mappings.put("", new MappingMetadata("_doc", Map.of("properties", Map.of("ml", "some-mapping"))));
         GetIndexResponse getIndexResponse =
-            new GetIndexResponse(
-                new String[] { DEST_INDEX }, mappings.build(), ImmutableOpenMap.of(), ImmutableOpenMap.of(), ImmutableOpenMap.of());
+            new GetIndexResponse(new String[] { DEST_INDEX }, mappings.build(), ImmutableOpenMap.of(), ImmutableOpenMap.of(),
+                ImmutableOpenMap.of(), ImmutableOpenMap.of());
 
         ElasticsearchStatusException e =
             expectThrows(

+ 2 - 2
x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/job/retention/EmptyStateIndexRemoverTests.java

@@ -114,7 +114,7 @@ public class EmptyStateIndexRemoverTests extends ESTestCase {
                 ".ml-state-e", indexStats(".ml-state-e", 0))).when(indicesStatsResponse).getIndices();
         doAnswer(withResponse(indicesStatsResponse)).when(client).execute(eq(IndicesStatsAction.INSTANCE), any(), any());
 
-        GetIndexResponse getIndexResponse = new GetIndexResponse(new String[] { ".ml-state-e" }, null, null, null, null);
+        GetIndexResponse getIndexResponse = new GetIndexResponse(new String[] { ".ml-state-e" }, null, null, null, null, null);
         doAnswer(withResponse(getIndexResponse)).when(client).execute(eq(GetIndexAction.INSTANCE), any(), any());
 
         AcknowledgedResponse deleteIndexResponse = new AcknowledgedResponse(acknowledged);
@@ -145,7 +145,7 @@ public class EmptyStateIndexRemoverTests extends ESTestCase {
         doReturn(Map.of(".ml-state-a", indexStats(".ml-state-a", 0))).when(indicesStatsResponse).getIndices();
         doAnswer(withResponse(indicesStatsResponse)).when(client).execute(eq(IndicesStatsAction.INSTANCE), any(), any());
 
-        GetIndexResponse getIndexResponse = new GetIndexResponse(new String[] { ".ml-state-a" }, null, null, null, null);
+        GetIndexResponse getIndexResponse = new GetIndexResponse(new String[] { ".ml-state-a" }, null, null, null, null, null);
         doAnswer(withResponse(getIndexResponse)).when(client).execute(eq(GetIndexAction.INSTANCE), any(), any());
 
         remover.remove(listener, () -> false);

+ 1 - 1
x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/checkpoint/TransformCheckpointServiceNodeTests.java

@@ -111,7 +111,7 @@ public class TransformCheckpointServiceNodeTests extends TransformSingleNodeTest
             if (request instanceof GetIndexRequest) {
                 // for this test we only need the indices
                 assert (indices != null);
-                final GetIndexResponse indexResponse = new GetIndexResponse(indices, null, null, null, null);
+                final GetIndexResponse indexResponse = new GetIndexResponse(indices, null, null, null, null, null);
 
                 listener.onResponse((Response) indexResponse);
                 return;