Skip to content

Commit a5fd4a7

Browse files
sohaibiftikharnik9000
authored andcommitted
Implemented XContent serialisation for GetIndexResponse (#31675)
This PR does the server side work for adding the Get Index API to the REST high-level-client, namely moving resolving default settings to the transport action. A follow up would be the client side changes.
1 parent ce78925 commit a5fd4a7

File tree

10 files changed

+652
-126
lines changed

10 files changed

+652
-126
lines changed

build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ task verifyVersions {
170170
* the enabled state of every bwc task. It should be set back to true
171171
* after the backport of the backcompat code is complete.
172172
*/
173-
final boolean bwc_tests_enabled = true
174-
final String bwc_tests_disabled_issue = "" /* place a PR link here when commiting bwc changes */
173+
final boolean bwc_tests_enabled = false
174+
final String bwc_tests_disabled_issue = "https://github.com/elastic/elasticsearch/pull/31675" /* place a PR link here when commiting bwc changes */
175175
if (bwc_tests_enabled == false) {
176176
if (bwc_tests_disabled_issue.isEmpty()) {
177177
throw new GradleException("bwc_tests_disabled_issue must be set when bwc_tests_enabled == false")

client/rest-high-level/src/test/java/org/elasticsearch/client/GetAliasesResponseTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private static Map<String, Set<AliasMetaData>> createIndicesAliasesMap(int min,
5959
return map;
6060
}
6161

62-
private static AliasMetaData createAliasMetaData() {
62+
public static AliasMetaData createAliasMetaData() {
6363
AliasMetaData.Builder builder = AliasMetaData.builder(randomAlphaOfLengthBetween(3, 10));
6464
if (randomBoolean()) {
6565
builder.routing(randomAlphaOfLengthBetween(3, 10));

server/src/main/java/org/elasticsearch/action/ActionModule.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ public void initRestHandlers(Supplier<DiscoveryNodes> nodesInCluster) {
557557
registerHandler.accept(new RestRestoreSnapshotAction(settings, restController));
558558
registerHandler.accept(new RestDeleteSnapshotAction(settings, restController));
559559
registerHandler.accept(new RestSnapshotsStatusAction(settings, restController));
560-
registerHandler.accept(new RestGetIndicesAction(settings, restController, indexScopedSettings, settingsFilter));
560+
registerHandler.accept(new RestGetIndicesAction(settings, restController));
561561
registerHandler.accept(new RestIndicesStatsAction(settings, restController));
562562
registerHandler.accept(new RestIndicesSegmentsAction(settings, restController));
563563
registerHandler.accept(new RestIndicesShardStoresAction(settings, restController));

server/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexRequest.java

+9-4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package org.elasticsearch.action.admin.indices.get;
2121

22+
import org.elasticsearch.Version;
2223
import org.elasticsearch.action.ActionRequestValidationException;
2324
import org.elasticsearch.action.support.master.info.ClusterInfoRequest;
2425
import org.elasticsearch.common.io.stream.StreamInput;
@@ -80,6 +81,9 @@ public GetIndexRequest(StreamInput in) throws IOException {
8081
features[i] = Feature.fromId(in.readByte());
8182
}
8283
humanReadable = in.readBoolean();
84+
if (in.getVersion().onOrAfter(Version.V_6_4_0)) {
85+
includeDefaults = in.readBoolean();
86+
}
8387
}
8488

8589
public GetIndexRequest features(Feature... features) {
@@ -119,8 +123,7 @@ public boolean humanReadable() {
119123

120124
/**
121125
* Sets the value of "include_defaults".
122-
* Used only by the high-level REST client.
123-
*
126+
*
124127
* @param includeDefaults value of "include_defaults" to be set.
125128
* @return this request
126129
*/
@@ -131,8 +134,7 @@ public GetIndexRequest includeDefaults(boolean includeDefaults) {
131134

132135
/**
133136
* Whether to return all default settings for each of the indices.
134-
* Used only by the high-level REST client.
135-
*
137+
*
136138
* @return <code>true</code> if defaults settings for each of the indices need to returned;
137139
* <code>false</code> otherwise.
138140
*/
@@ -153,6 +155,9 @@ public void writeTo(StreamOutput out) throws IOException {
153155
out.writeByte(feature.id);
154156
}
155157
out.writeBoolean(humanReadable);
158+
if (out.getVersion().onOrAfter(Version.V_6_4_0)) {
159+
out.writeBoolean(includeDefaults);
160+
}
156161
}
157162

158163
}

0 commit comments

Comments
 (0)