Display all available endpoints by default at /_cat

Closes #5106
This commit is contained in:
Andrew Raines 2014-03-07 13:21:43 -06:00
parent d7b0d547d4
commit 2f48be597e
2 changed files with 3 additions and 8 deletions

View File

@ -13,7 +13,7 @@ when looking at an ssh terminal, need compact and aligned text. The
cat API aims to meet this need. cat API aims to meet this need.
All the cat commands accept a query string parameter `help` to see all All the cat commands accept a query string parameter `help` to see all
the headers and info they provide, and the `/_cat?help` command lists all the headers and info they provide, and the `/_cat` command alone lists all
the available commands. the available commands.
[float] [float]

View File

@ -40,7 +40,7 @@ public class RestCatAction extends BaseRestHandler {
super(settings, client); super(settings, client);
controller.registerHandler(GET, "/_cat", this); controller.registerHandler(GET, "/_cat", this);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(CAT).append(" try:\n"); sb.append(CAT_NL);
for (AbstractCatAction catAction : catActions) { for (AbstractCatAction catAction : catActions) {
catAction.documentation(sb); catAction.documentation(sb);
} }
@ -50,12 +50,7 @@ public class RestCatAction extends BaseRestHandler {
@Override @Override
public void handleRequest(final RestRequest request, final RestChannel channel) { public void handleRequest(final RestRequest request, final RestChannel channel) {
try { try {
boolean helpWanted = request.paramAsBoolean("h", request.paramAsBoolean("help", false)); channel.sendResponse(new StringRestResponse(RestStatus.OK, HELP));
if (helpWanted) {
channel.sendResponse(new StringRestResponse(RestStatus.OK, HELP));
} else {
channel.sendResponse(new StringRestResponse(RestStatus.OK, CAT_NL));
}
} catch (Throwable t) { } catch (Throwable t) {
try { try {
channel.sendResponse(new XContentThrowableRestResponse(request, t)); channel.sendResponse(new XContentThrowableRestResponse(request, t));