Add option to `_cat/indices` to return index creation date #11524

Returning index creation date, both as a numeric millisecond value and
as a string. This implements #11524
This commit is contained in:
szroland 2015-06-16 02:35:19 +02:00
parent ac2e0fd6a0
commit 35d947b524
1 changed files with 7 additions and 0 deletions

View File

@ -42,6 +42,7 @@ import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestActionListener;
import org.elasticsearch.rest.action.support.RestResponseListener;
import org.elasticsearch.rest.action.support.RestTable;
import org.joda.time.DateTime;
import java.util.Locale;
@ -112,6 +113,9 @@ public class RestIndicesAction extends AbstractCatAction {
table.addCell("docs.count", "alias:dc,docsCount;text-align:right;desc:available docs");
table.addCell("docs.deleted", "alias:dd,docsDeleted;text-align:right;desc:deleted docs");
table.addCell("creation.date", "alias:cd;default:false;desc:index creation date (millisecond value)");
table.addCell("creation.date.string", "alias:cds;default:false;desc:index creation date (as string)");
table.addCell("store.size", "sibling:pri;alias:ss,storeSize;text-align:right;desc:store size of primaries & replicas");
table.addCell("pri.store.size", "text-align:right;desc:store size of primaries");
@ -320,6 +324,9 @@ public class RestIndicesAction extends AbstractCatAction {
table.addCell(indexStats == null ? null : indexStats.getPrimaries().getDocs().getCount());
table.addCell(indexStats == null ? null : indexStats.getPrimaries().getDocs().getDeleted());
table.addCell(indexMetaData.creationDate());
table.addCell(new DateTime(indexMetaData.creationDate()));
table.addCell(indexStats == null ? null : indexStats.getTotal().getStore().size());
table.addCell(indexStats == null ? null : indexStats.getPrimaries().getStore().size());