Browse Source

Remove include_default query param from get data stream options. (#128730) (#128809)

Initially we added to the `include_defaults` to the get data stream
options REST API as it was used in the lifecycler API; however, we
decided to simplify it and not use it. We remove it now before it gets
adopted.

(cherry picked from commit 9764730d49425d9bc06f84b176723b931b43c367)

# Conflicts:
#	server/src/main/java/org/elasticsearch/TransportVersions.java
Mary Gouseti 4 months ago
parent
commit
b06534d02e

+ 9 - 17
modules/data-streams/src/main/java/org/elasticsearch/datastreams/options/action/GetDataStreamOptionsAction.java

@@ -8,6 +8,7 @@
  */
 package org.elasticsearch.datastreams.options.action;
 
+import org.elasticsearch.TransportVersions;
 import org.elasticsearch.action.ActionRequestValidationException;
 import org.elasticsearch.action.ActionResponse;
 import org.elasticsearch.action.ActionType;
@@ -54,7 +55,6 @@ public class GetDataStreamOptionsAction {
                 IndicesOptions.GatekeeperOptions.builder().allowAliasToMultipleIndices(false).allowClosedIndices(true).allowSelectors(false)
             )
             .build();
-        private boolean includeDefaults = false;
 
         public Request(TimeValue masterNodeTimeout, String[] names) {
             super(masterNodeTimeout);
@@ -64,7 +64,6 @@ public class GetDataStreamOptionsAction {
         public Request(TimeValue masterNodeTimeout, String[] names, boolean includeDefaults) {
             super(masterNodeTimeout);
             this.names = names;
-            this.includeDefaults = includeDefaults;
         }
 
         public String[] getNames() {
@@ -80,7 +79,9 @@ public class GetDataStreamOptionsAction {
             super(in);
             this.names = in.readOptionalStringArray();
             this.indicesOptions = IndicesOptions.readIndicesOptions(in);
-            this.includeDefaults = in.readBoolean();
+            if (in.getTransportVersion().before(TransportVersions.DATA_STREAM_OPTIONS_API_REMOVE_INCLUDE_DEFAULTS_8_19)) {
+                in.readBoolean();
+            }
         }
 
         @Override
@@ -88,7 +89,9 @@ public class GetDataStreamOptionsAction {
             super.writeTo(out);
             out.writeOptionalStringArray(names);
             indicesOptions.writeIndicesOptions(out);
-            out.writeBoolean(includeDefaults);
+            if (out.getTransportVersion().before(TransportVersions.DATA_STREAM_OPTIONS_API_REMOVE_INCLUDE_DEFAULTS_8_19)) {
+                out.writeBoolean(false);
+            }
         }
 
         @Override
@@ -96,14 +99,12 @@ public class GetDataStreamOptionsAction {
             if (this == o) return true;
             if (o == null || getClass() != o.getClass()) return false;
             Request request = (Request) o;
-            return Arrays.equals(names, request.names)
-                && indicesOptions.equals(request.indicesOptions)
-                && includeDefaults == request.includeDefaults;
+            return Arrays.equals(names, request.names) && indicesOptions.equals(request.indicesOptions);
         }
 
         @Override
         public int hashCode() {
-            int result = Objects.hash(indicesOptions, includeDefaults);
+            int result = Objects.hash(indicesOptions);
             result = 31 * result + Arrays.hashCode(names);
             return result;
         }
@@ -118,10 +119,6 @@ public class GetDataStreamOptionsAction {
             return indicesOptions;
         }
 
-        public boolean includeDefaults() {
-            return includeDefaults;
-        }
-
         public Request indicesOptions(IndicesOptions indicesOptions) {
             this.indicesOptions = indicesOptions;
             return this;
@@ -137,11 +134,6 @@ public class GetDataStreamOptionsAction {
             this.names = indices;
             return this;
         }
-
-        public Request includeDefaults(boolean includeDefaults) {
-            this.includeDefaults = includeDefaults;
-            return this;
-        }
     }
 
     public static class Response extends ActionResponse implements ChunkedToXContentObject {

+ 0 - 1
modules/data-streams/src/main/java/org/elasticsearch/datastreams/options/rest/RestGetDataStreamOptionsAction.java

@@ -46,7 +46,6 @@ public class RestGetDataStreamOptionsAction extends BaseRestHandler {
             RestUtils.getMasterNodeTimeout(request),
             Strings.splitStringByCommaToArray(request.param("name"))
         );
-        getDataStreamOptionsRequest.includeDefaults(request.paramAsBoolean("include_defaults", false));
         getDataStreamOptionsRequest.indicesOptions(IndicesOptions.fromRequest(request, getDataStreamOptionsRequest.indicesOptions()));
         return channel -> client.execute(
             GetDataStreamOptionsAction.INSTANCE,

+ 0 - 4
rest-api-spec/src/main/resources/rest-api-spec/api/indices.get_data_stream_options.json

@@ -38,10 +38,6 @@
         "default":"open",
         "description":"Whether wildcard expressions should get expanded to open or closed indices (default: open)"
       },
-      "include_defaults":{
-        "type":"boolean",
-        "description":"Return all relevant default configurations for the data stream (default: false)"
-      },
       "master_timeout":{
         "type":"time",
         "description":"Specify timeout for connection to master"

+ 1 - 0
server/src/main/java/org/elasticsearch/TransportVersions.java

@@ -230,6 +230,7 @@ public class TransportVersions {
     public static final TransportVersion ML_INFERENCE_VERTEXAI_CHATCOMPLETION_ADDED_8_19 = def(8_841_0_38);
     public static final TransportVersion INFERENCE_CUSTOM_SERVICE_ADDED_8_19 = def(8_841_0_39);
     public static final TransportVersion IDP_CUSTOM_SAML_ATTRIBUTES_ADDED_8_19 = def(8_841_0_40);
+    public static final TransportVersion DATA_STREAM_OPTIONS_API_REMOVE_INCLUDE_DEFAULTS_8_19 = def(8_841_0_41);
     /*
      * STOP! READ THIS FIRST! No, really,
      *        ____ _____ ___  ____  _        ____  _____    _    ____    _____ _   _ ___ ____    _____ ___ ____  ____ _____ _