Convert _cat/count to TimestampedTable.

This commit is contained in:
Andrew Raines 2013-11-29 02:19:56 -06:00
parent d16aacb8d3
commit 9aee9949e5
1 changed files with 2 additions and 10 deletions

View File

@ -26,14 +26,13 @@ import org.elasticsearch.action.support.broadcast.BroadcastOperationThreading;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.Table;
import org.elasticsearch.common.table.TimestampedTable;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestActions;
import org.elasticsearch.rest.action.support.RestTable;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import java.io.IOException;
@ -41,8 +40,6 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestCountAction extends BaseRestHandler {
private DateTimeFormatter dateFormat = DateTimeFormat.forPattern("HH:mm:ss");
@Inject
protected RestCountAction(Settings settings, Client client, RestController restController) {
super(settings, client);
@ -89,17 +86,12 @@ public class RestCountAction extends BaseRestHandler {
private Table buildTable(CountResponse response) {
Table table = new Table();
Table table = new TimestampedTable();
table.startHeaders();
table.addCell("time(ms)", "desc:time, in milliseconds since epoch UTC, that the count was executed");
table.addCell("timestamp", "desc:time that the count was executed");
table.addCell("count", "desc:the document count");
table.endHeaders();
long time = System.currentTimeMillis();
table.startRow();
table.addCell(time);
table.addCell(dateFormat.print(time));
table.addCell(response.getCount());
table.endRow();