Skip to content

Commit b06534d

Browse files
authored
Remove include_default query param from get data stream options. (elastic#128730) (elastic#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 9764730) # Conflicts: # server/src/main/java/org/elasticsearch/TransportVersions.java
1 parent dda4c6f commit b06534d

File tree

4 files changed

+10
-22
lines changed

4 files changed

+10
-22
lines changed

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

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99
package org.elasticsearch.datastreams.options.action;
1010

11+
import org.elasticsearch.TransportVersions;
1112
import org.elasticsearch.action.ActionRequestValidationException;
1213
import org.elasticsearch.action.ActionResponse;
1314
import org.elasticsearch.action.ActionType;
@@ -54,7 +55,6 @@ public static class Request extends MasterNodeReadRequest<Request> implements In
5455
IndicesOptions.GatekeeperOptions.builder().allowAliasToMultipleIndices(false).allowClosedIndices(true).allowSelectors(false)
5556
)
5657
.build();
57-
private boolean includeDefaults = false;
5858

5959
public Request(TimeValue masterNodeTimeout, String[] names) {
6060
super(masterNodeTimeout);
@@ -64,7 +64,6 @@ public Request(TimeValue masterNodeTimeout, String[] names) {
6464
public Request(TimeValue masterNodeTimeout, String[] names, boolean includeDefaults) {
6565
super(masterNodeTimeout);
6666
this.names = names;
67-
this.includeDefaults = includeDefaults;
6867
}
6968

7069
public String[] getNames() {
@@ -80,30 +79,32 @@ public Request(StreamInput in) throws IOException {
8079
super(in);
8180
this.names = in.readOptionalStringArray();
8281
this.indicesOptions = IndicesOptions.readIndicesOptions(in);
83-
this.includeDefaults = in.readBoolean();
82+
if (in.getTransportVersion().before(TransportVersions.DATA_STREAM_OPTIONS_API_REMOVE_INCLUDE_DEFAULTS_8_19)) {
83+
in.readBoolean();
84+
}
8485
}
8586

8687
@Override
8788
public void writeTo(StreamOutput out) throws IOException {
8889
super.writeTo(out);
8990
out.writeOptionalStringArray(names);
9091
indicesOptions.writeIndicesOptions(out);
91-
out.writeBoolean(includeDefaults);
92+
if (out.getTransportVersion().before(TransportVersions.DATA_STREAM_OPTIONS_API_REMOVE_INCLUDE_DEFAULTS_8_19)) {
93+
out.writeBoolean(false);
94+
}
9295
}
9396

9497
@Override
9598
public boolean equals(Object o) {
9699
if (this == o) return true;
97100
if (o == null || getClass() != o.getClass()) return false;
98101
Request request = (Request) o;
99-
return Arrays.equals(names, request.names)
100-
&& indicesOptions.equals(request.indicesOptions)
101-
&& includeDefaults == request.includeDefaults;
102+
return Arrays.equals(names, request.names) && indicesOptions.equals(request.indicesOptions);
102103
}
103104

104105
@Override
105106
public int hashCode() {
106-
int result = Objects.hash(indicesOptions, includeDefaults);
107+
int result = Objects.hash(indicesOptions);
107108
result = 31 * result + Arrays.hashCode(names);
108109
return result;
109110
}
@@ -118,10 +119,6 @@ public IndicesOptions indicesOptions() {
118119
return indicesOptions;
119120
}
120121

121-
public boolean includeDefaults() {
122-
return includeDefaults;
123-
}
124-
125122
public Request indicesOptions(IndicesOptions indicesOptions) {
126123
this.indicesOptions = indicesOptions;
127124
return this;
@@ -137,11 +134,6 @@ public IndicesRequest indices(String... indices) {
137134
this.names = indices;
138135
return this;
139136
}
140-
141-
public Request includeDefaults(boolean includeDefaults) {
142-
this.includeDefaults = includeDefaults;
143-
return this;
144-
}
145137
}
146138

147139
public static class Response extends ActionResponse implements ChunkedToXContentObject {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient cli
4646
RestUtils.getMasterNodeTimeout(request),
4747
Strings.splitStringByCommaToArray(request.param("name"))
4848
);
49-
getDataStreamOptionsRequest.includeDefaults(request.paramAsBoolean("include_defaults", false));
5049
getDataStreamOptionsRequest.indicesOptions(IndicesOptions.fromRequest(request, getDataStreamOptionsRequest.indicesOptions()));
5150
return channel -> client.execute(
5251
GetDataStreamOptionsAction.INSTANCE,

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@
3838
"default":"open",
3939
"description":"Whether wildcard expressions should get expanded to open or closed indices (default: open)"
4040
},
41-
"include_defaults":{
42-
"type":"boolean",
43-
"description":"Return all relevant default configurations for the data stream (default: false)"
44-
},
4541
"master_timeout":{
4642
"type":"time",
4743
"description":"Specify timeout for connection to master"

server/src/main/java/org/elasticsearch/TransportVersions.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ static TransportVersion def(int id) {
230230
public static final TransportVersion ML_INFERENCE_VERTEXAI_CHATCOMPLETION_ADDED_8_19 = def(8_841_0_38);
231231
public static final TransportVersion INFERENCE_CUSTOM_SERVICE_ADDED_8_19 = def(8_841_0_39);
232232
public static final TransportVersion IDP_CUSTOM_SAML_ATTRIBUTES_ADDED_8_19 = def(8_841_0_40);
233+
public static final TransportVersion DATA_STREAM_OPTIONS_API_REMOVE_INCLUDE_DEFAULTS_8_19 = def(8_841_0_41);
233234
/*
234235
* STOP! READ THIS FIRST! No, really,
235236
* ____ _____ ___ ____ _ ____ _____ _ ____ _____ _ _ ___ ____ _____ ___ ____ ____ _____ _

0 commit comments

Comments
 (0)