From 35d947b5245ff3247a5f415a49b7c705832676ed Mon Sep 17 00:00:00 2001 From: szroland Date: Tue, 16 Jun 2015 02:35:19 +0200 Subject: [PATCH] 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 --- .../elasticsearch/rest/action/cat/RestIndicesAction.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java b/core/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java index 352588cca71..36f044ff117 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java @@ -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());