diff --git a/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/action/XPackInfoRequest.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/action/XPackInfoRequest.java index a01fc96b249..64f0b512cb6 100644 --- a/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/action/XPackInfoRequest.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/action/XPackInfoRequest.java @@ -25,7 +25,14 @@ public class XPackInfoRequest extends ActionRequest { public static EnumSet toSet(String... categories) { EnumSet set = EnumSet.noneOf(Category.class); for (String category : categories) { - set.add(Category.valueOf(category.toUpperCase(Locale.ROOT))); + switch (category) { + case "_all": + return EnumSet.allOf(Category.class); + case "_none": + return EnumSet.noneOf(Category.class); + default: + set.add(Category.valueOf(category.toUpperCase(Locale.ROOT))); + } } return set; } diff --git a/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/rest/action/RestXPackInfoAction.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/rest/action/RestXPackInfoAction.java index 5b1119c8ac4..fe24da5acfa 100644 --- a/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/rest/action/RestXPackInfoAction.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/rest/action/RestXPackInfoAction.java @@ -6,7 +6,6 @@ package org.elasticsearch.xpack.rest.action; import org.elasticsearch.client.Client; -import org.elasticsearch.common.Strings; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -40,10 +39,10 @@ public class RestXPackInfoAction extends XPackRestHandler { protected void handleRequest(RestRequest request, RestChannel restChannel, XPackClient client) throws Exception { // we piggyback verbosity on "human" output - boolean verbose = request.paramAsBoolean("human", false); + boolean verbose = request.paramAsBoolean("human", true); EnumSet categories = XPackInfoRequest.Category - .toSet(request.paramAsStringArray("categories", Strings.EMPTY_ARRAY)); + .toSet(request.paramAsStringArray("categories", new String[] { "_all" })); client.prepareInfo().setVerbose(verbose).setCategories(categories).execute(new RestBuilderListener(restChannel) { @Override public RestResponse buildResponse(XPackInfoResponse infoResponse, XContentBuilder builder) throws Exception { diff --git a/elasticsearch/x-pack/src/test/resources/rest-api-spec/test/xpack/15_basic.yaml b/elasticsearch/x-pack/src/test/resources/rest-api-spec/test/xpack/15_basic.yaml index 6d5e3413c1a..713ff499e49 100644 --- a/elasticsearch/x-pack/src/test/resources/rest-api-spec/test/xpack/15_basic.yaml +++ b/elasticsearch/x-pack/src/test/resources/rest-api-spec/test/xpack/15_basic.yaml @@ -56,24 +56,6 @@ - do: xpack.info: {} - - is_false: tagline - - is_false: build - - is_false: features - - is_false: license - - - do: - xpack.info: - categories: "build" - - is_true: build - - is_true: build.hash - - is_true: build.timestamp - - is_false: tagline - - is_false: features - - is_false: license - - - do: - xpack.info: - categories: "build,license" - is_true: build.hash - is_true: build.timestamp - is_true: license @@ -82,12 +64,71 @@ - match: { license.mode: "platinum" } - match: { license.status: "active" } - match: { license.expiry_date_in_millis: 1914278399999 } - - is_false: tagline + - is_true: features + - is_true: features.watcher + - is_true: features.watcher.enabled + - is_true: features.watcher.available + - is_true: features.watcher.description + - is_true: features.security + - is_true: features.security.enabled + - is_true: features.security.available + - is_true: features.security.description + - is_true: features.graph + - is_true: features.graph.enabled + - is_true: features.graph.available + - is_true: features.graph.description + - is_true: features.monitoring + - is_true: features.monitoring.enabled + - is_true: features.monitoring.available + - is_true: features.monitoring.description + - is_true: tagline + + - do: + xpack.info: + categories: "_none" + - is_false: build + - is_false: features + - is_false: license + - match: { tagline: "You know, for X" } + + - do: + xpack.info: + categories: "_none" + human: false + - is_false: build + - is_false: features + - is_false: license + - is_false: tagline + + - do: + xpack.info: + categories: "build" + - is_true: build + - is_true: build.hash + - is_true: build.timestamp + - is_true: tagline - is_false: features + - is_false: license + + - do: + xpack.info: + categories: "build,license" + - is_true: build.hash + - is_true: build.timestamp + - is_true: tagline + - is_false: features + - is_true: license + - match: { license.uid: "893361dc-9749-4997-93cb-802e3dofh7aa" } + - match: { license.type: "internal" } + - match: { license.mode: "platinum" } + - match: { license.status: "active" } + - match: { license.expiry_date_in_millis: 1914278399999 } + - do: xpack.info: categories: "build,license,features" + human: false - is_true: build.hash - is_true: build.timestamp - is_true: license @@ -115,33 +156,4 @@ - is_false: features.monitoring.description - is_false: tagline - - do: - xpack.info: - categories: "build,license,features" - human: "true" - - is_true: build.hash - - is_true: build.timestamp - - is_true: license - - match: { license.uid: "893361dc-9749-4997-93cb-802e3dofh7aa" } - - match: { license.type: "internal" } - - match: { license.mode: "platinum" } - - match: { license.status: "active" } - - match: { license.expiry_date_in_millis: 1914278399999 } - - is_true: features - - is_true: features.watcher - - is_true: features.watcher.enabled - - is_true: features.watcher.available - - is_true: features.watcher.description - - is_true: features.security - - is_true: features.security.enabled - - is_true: features.security.available - - is_true: features.security.description - - is_true: features.graph - - is_true: features.graph.enabled - - is_true: features.graph.available - - is_true: features.graph.description - - is_true: features.monitoring - - is_true: features.monitoring.enabled - - is_true: features.monitoring.available - - is_true: features.monitoring.description - - is_true: tagline +