Skip to content

Commit

Permalink
Implemented XContent serialisation for GetIndexResponse (#31675)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sohaibiftikhar authored and nik9000 committed Jul 3, 2018
1 parent ce78925 commit a5fd4a7
Show file tree
Hide file tree
Showing 10 changed files with 652 additions and 126 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ task verifyVersions {
* the enabled state of every bwc task. It should be set back to true
* after the backport of the backcompat code is complete.
*/
final boolean bwc_tests_enabled = true
final String bwc_tests_disabled_issue = "" /* place a PR link here when commiting bwc changes */
final boolean bwc_tests_enabled = false
final String bwc_tests_disabled_issue = "https://github.com/elastic/elasticsearch/pull/31675" /* place a PR link here when commiting bwc changes */
if (bwc_tests_enabled == false) {
if (bwc_tests_disabled_issue.isEmpty()) {
throw new GradleException("bwc_tests_disabled_issue must be set when bwc_tests_enabled == false")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private static Map<String, Set<AliasMetaData>> createIndicesAliasesMap(int min,
return map;
}

private static AliasMetaData createAliasMetaData() {
public static AliasMetaData createAliasMetaData() {
AliasMetaData.Builder builder = AliasMetaData.builder(randomAlphaOfLengthBetween(3, 10));
if (randomBoolean()) {
builder.routing(randomAlphaOfLengthBetween(3, 10));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ public void initRestHandlers(Supplier<DiscoveryNodes> nodesInCluster) {
registerHandler.accept(new RestRestoreSnapshotAction(settings, restController));
registerHandler.accept(new RestDeleteSnapshotAction(settings, restController));
registerHandler.accept(new RestSnapshotsStatusAction(settings, restController));
registerHandler.accept(new RestGetIndicesAction(settings, restController, indexScopedSettings, settingsFilter));
registerHandler.accept(new RestGetIndicesAction(settings, restController));
registerHandler.accept(new RestIndicesStatsAction(settings, restController));
registerHandler.accept(new RestIndicesSegmentsAction(settings, restController));
registerHandler.accept(new RestIndicesShardStoresAction(settings, restController));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

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

import org.elasticsearch.Version;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.master.info.ClusterInfoRequest;
import org.elasticsearch.common.io.stream.StreamInput;
Expand Down Expand Up @@ -80,6 +81,9 @@ public GetIndexRequest(StreamInput in) throws IOException {
features[i] = Feature.fromId(in.readByte());
}
humanReadable = in.readBoolean();
if (in.getVersion().onOrAfter(Version.V_6_4_0)) {
includeDefaults = in.readBoolean();
}
}

public GetIndexRequest features(Feature... features) {
Expand Down Expand Up @@ -119,8 +123,7 @@ public boolean humanReadable() {

/**
* Sets the value of "include_defaults".
* Used only by the high-level REST client.
*
*
* @param includeDefaults value of "include_defaults" to be set.
* @return this request
*/
Expand All @@ -131,8 +134,7 @@ public GetIndexRequest includeDefaults(boolean includeDefaults) {

/**
* Whether to return all default settings for each of the indices.
* Used only by the high-level REST client.
*
*
* @return <code>true</code> if defaults settings for each of the indices need to returned;
* <code>false</code> otherwise.
*/
Expand All @@ -153,6 +155,9 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeByte(feature.id);
}
out.writeBoolean(humanReadable);
if (out.getVersion().onOrAfter(Version.V_6_4_0)) {
out.writeBoolean(includeDefaults);
}
}

}
Loading

0 comments on commit a5fd4a7

Please sign in to comment.