Merge pull request #11688 from szroland/master

Add option to `_cat/indices` to return index creation date #11524
This commit is contained in:
Nik Everett 2015-08-03 14:42:18 -04:00
commit c82717789c
2 changed files with 23 additions and 0 deletions

View File

@ -42,6 +42,8 @@ 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 org.joda.time.DateTimeZone;
import java.util.Locale;
@ -112,6 +114,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 +325,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(), DateTimeZone.getDefault()));
table.addCell(indexStats == null ? null : indexStats.getTotal().getStore().size());
table.addCell(indexStats == null ? null : indexStats.getPrimaries().getStore().size());

View File

@ -36,3 +36,18 @@
(\d+|\d+[.]\d+)(kb|b) \s*
)
$/
- do:
cat.indices:
v: false
h: i,cd,cds,creation.date,creation.date.string
- match:
$body: |
/^(
index1 \s+
(\d+) \s+
(\d\d\d\d\-\d\d\-\d\dT\d\d:\d\d:\d\d.\d\d\d[+-]\d\d:\d\d) \s+
(\d+) \s+
(\d\d\d\d\-\d\d\-\d\dT\d\d:\d\d:\d\d.\d\d\d[+-]\d\d:\d\d) \s*
)
$/