Convert _cat/count to TimestampedTable.
This commit is contained in:
parent
d16aacb8d3
commit
9aee9949e5
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue