From 2c8baeaa4aa40d785f41518488409695e4b073cd Mon Sep 17 00:00:00 2001 From: Andrew Raines Date: Sat, 11 Jan 2014 17:25:07 -0600 Subject: [PATCH] Support sibling columns, with _cat/indices?pri as first go. % curl localhost:9200/_cat/indices\?h=health,index,rep,docs.count,ss,cs,fm\&v\&pri health index rep docs.count ss pri.ss cs pri.cs fm pri.fm green wiki 1 6401 302.9mb 151.4mb 0b 0b 25.1mb 0b green twitter 1 11434 64mb 32mb 0b 0b 0b 0b Closes #4689. --- .../java/org/elasticsearch/common/Table.java | 9 + .../rest/action/cat/RestIndicesAction.java | 362 ++++++++++-------- .../rest/action/support/RestTable.java | 23 +- 3 files changed, 233 insertions(+), 161 deletions(-) diff --git a/src/main/java/org/elasticsearch/common/Table.java b/src/main/java/org/elasticsearch/common/Table.java index 020db375e6f..a40bb33b6f8 100644 --- a/src/main/java/org/elasticsearch/common/Table.java +++ b/src/main/java/org/elasticsearch/common/Table.java @@ -35,6 +35,7 @@ public class Table { private List headers = new ArrayList(); private List> rows = new ArrayList>(); private Map> map = Maps.newHashMap(); + private Map headerMap = Maps.newHashMap(); private List currentCells; private boolean inHeaders = false; @@ -55,9 +56,13 @@ public class Table { * header1 => [Cell, Cell, ...] * header2 => [Cell, Cell, ...] * header3 => [Cell, Cell, ...] + * + * Also populate map to look up headers by name. + * */ for (Cell header : headers) { map.put(header.value.toString(), new ArrayList()); + headerMap.put(header.value.toString(), header); } return this; @@ -149,6 +154,10 @@ public class Table { return this.map; } + public Map getHeaderMap() { + return this.headerMap; + } + public Cell findHeaderByName(String header) { for (Cell cell : headers) { if (cell.value.toString().equals(header)) { diff --git a/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java b/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java index a120c4be865..5eef9bedf06 100644 --- a/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java +++ b/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java @@ -130,130 +130,152 @@ public class RestIndicesAction extends AbstractCatAction { table.addCell("index", "desc:index name"); table.addCell("pri", "text-align:right;desc:number of primary shards"); table.addCell("rep", "text-align:right;desc:number of replica shards"); - table.addCell("docs.count", "text-align:right;desc:available docs"); - table.addCell("docs.deleted", "text-align:right;desc:deleted docs"); - table.addCell("primaries.store.size", "text-align:right;desc:store size of primaries"); - table.addCell("total.store.size", "text-align:right;desc:store size of primaries & replicas"); + table.addCell("docs.count", "alias:docsCount;text-align:right;desc:available docs"); + table.addCell("docs.deleted", "alias:docsDeleted;text-align:right;desc:deleted docs"); - table.addCell("pri.completion.size", "alias:pcs,priCompletionSize;default:false;text-align:right;desc:size of completion"); + 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"); - table.addCell("pri.fielddata.memory_size", "alias:pfm,priFielddataMemory;default:false;text-align:right;desc:used fielddata cache"); - table.addCell("pri.fielddata.evictions", "alias:pfe,priFielddataEvictions;default:false;text-align:right;desc:fielddata evictions"); + table.addCell("completion.size", "sibling:pri;alias:cs,completionSize;default:false;text-align:right;desc:size of completion"); + table.addCell("pri.completion.size", "default:false;text-align:right;desc:size of completion"); - table.addCell("pri.filter_cache.memory_size", "alias:pfcm,priFilterCacheMemory;default:false;text-align:right;desc:used filter cache"); - table.addCell("pri.filter_cache.evictions", "alias:pfce,priFilterCacheEvictions;default:false;text-align:right;desc:filter cache evictions"); + table.addCell("fielddata.memory_size", "sibling:pri;alias:fm,fielddataMemory;default:false;text-align:right;desc:used fielddata cache"); + table.addCell("pri.fielddata.memory_size", "default:false;text-align:right;desc:used fielddata cache"); - table.addCell("pri.flush.total", "alias:pft,priFlushTotal;default:false;text-align:right;desc:number of flushes"); - table.addCell("pri.flush.total_time", "alias:pftt,priFlushTotalTime;default:false;text-align:right;desc:time spent in flush"); + table.addCell("fielddata.evictions", "sibling:pri;alias:fe,fielddataEvictions;default:false;text-align:right;desc:fielddata evictions"); + table.addCell("pri.fielddata.evictions", "default:false;text-align:right;desc:fielddata evictions"); - table.addCell("pri.get.current", "alias:pgc,priGetCurrent;default:false;text-align:right;desc:number of current get ops"); - table.addCell("pri.get.time", "alias:pgti,priGetTime;default:false;text-align:right;desc:time spent in get"); - table.addCell("pri.get.total", "alias:pgto,priGetTotal;default:false;text-align:right;desc:number of get ops"); - table.addCell("pri.get.exists_time", "alias:pgeti,priGetExistsTime;default:false;text-align:right;desc:time spent in successful gets"); - table.addCell("pri.get.exists_total", "alias:pgeto,priGetExistsTotal;default:false;text-align:right;desc:number of successful gets"); - table.addCell("pri.get.missing_time", "alias:pgmti,priGetMissingTime;default:false;text-align:right;desc:time spent in failed gets"); - table.addCell("pri.get.missing_total", "alias:pgmto,priGetMissingTotal;default:false;text-align:right;desc:number of failed gets"); + table.addCell("filter_cache.memory_size", "sibling:pri;alias:fcm,filterCacheMemory;default:false;text-align:right;desc:used filter cache"); + table.addCell("pri.filter_cache.memory_size", "default:false;text-align:right;desc:used filter cache"); - table.addCell("pri.id_cache.memory_size", "alias:pim,priIdCacheMemory;default:false;text-align:right;desc:used id cache"); + table.addCell("filter_cache.evictions", "sibling:pri;alias:fce,filterCacheEvictions;default:false;text-align:right;desc:filter cache evictions"); + table.addCell("pri.filter_cache.evictions", "default:false;text-align:right;desc:filter cache evictions"); - table.addCell("pri.indexing.delete_current", "alias:pidc,priIndexingDeleteCurrent;default:false;text-align:right;desc:number of current deletions"); - table.addCell("pri.indexing.delete_time", "alias:pidti,priIndexingDeleteTime;default:false;text-align:right;desc:time spent in deletions"); - table.addCell("pri.indexing.delete_total", "alias:pidto,priIndexingDeleteTotal;default:false;text-align:right;desc:number of delete ops"); - table.addCell("pri.indexing.index_current", "alias:piic,priIndexingIndexCurrent;default:false;text-align:right;desc:number of current indexing ops"); - table.addCell("pri.indexing.index_time", "alias:piiti,priIndexingIndexTime;default:false;text-align:right;desc:time spent in indexing"); - table.addCell("pri.indexing.index_total", "alias:piito,priIndexingIndexTotal;default:false;text-align:right;desc:number of indexing ops"); + table.addCell("flush.total", "sibling:pri;alias:ft,flushTotal;default:false;text-align:right;desc:number of flushes"); + table.addCell("pri.flush.total", "default:false;text-align:right;desc:number of flushes"); - table.addCell("pri.merges.current", "alias:pmc,priMergesCurrent;default:false;text-align:right;desc:number of current merges"); - table.addCell("pri.merges.current_docs", "alias:pmcd,priMergesCurrentDocs;default:false;text-align:right;desc:number of current merging docs"); - table.addCell("pri.merges.current_size", "alias:pmcs,priMergesCurrentSize;default:false;text-align:right;desc:size of current merges"); - table.addCell("pri.merges.total", "alias:pmt,priMergesTotal;default:false;text-align:right;desc:number of completed merge ops"); - table.addCell("pri.merges.total_docs", "alias:pmtd,priMergesTotalDocs;default:false;text-align:right;desc:docs merged"); - table.addCell("pri.merges.total_size", "alias:pmts,priMergesTotalSize;default:false;text-align:right;desc:size merged"); - table.addCell("pri.merges.total_time", "alias:pmtt,priMergesTotalTime;default:false;text-align:right;desc:time spent in merges"); + table.addCell("flush.total_time", "sibling:pri;alias:ftt,flushTotalTime;default:false;text-align:right;desc:time spent in flush"); + table.addCell("pri.flush.total_time", "default:false;text-align:right;desc:time spent in flush"); - table.addCell("pri.percolate.current", "alias:ppc,priPercolateCurrent;default:false;text-align:right;desc:number of current percolations"); - table.addCell("pri.percolate.memory_size", "alias:ppm,priPercolateMemory;default:false;text-align:right;desc:memory used by percolations"); - table.addCell("pri.percolate.queries", "alias:ppq,priPercolateQueries;default:false;text-align:right;desc:number of registered percolation queries"); - table.addCell("pri.percolate.time", "alias:ppti,priPercolateTime;default:false;text-align:right;desc:time spent percolating"); - table.addCell("pri.percolate.total", "alias:ppto,priPercolateTotal;default:false;text-align:right;desc:total percolations"); + table.addCell("get.current", "sibling:pri;alias:gc,getCurrent;default:false;text-align:right;desc:number of current get ops"); + table.addCell("pri.get.current", "default:false;text-align:right;desc:number of current get ops"); - table.addCell("pri.refresh.total", "alias:prto,priRefreshTotal;default:false;text-align:right;desc:total refreshes"); - table.addCell("pri.refresh.time", "alias:prti,priRefreshTime;default:false;text-align:right;desc:time spent in refreshes"); + table.addCell("get.time", "sibling:pri;alias:gti,getTime;default:false;text-align:right;desc:time spent in get"); + table.addCell("pri.get.time", "default:false;text-align:right;desc:time spent in get"); - table.addCell("pri.search.fetch_current", "alias:psfc,priSearchFetchCurrent;default:false;text-align:right;desc:current fetch phase ops"); - table.addCell("pri.search.fetch_time", "alias:psfti,priSearchFetchTime;default:false;text-align:right;desc:time spent in fetch phase"); - table.addCell("pri.search.fetch_total", "alias:psfto,priSearchFetchTotal;default:false;text-align:right;desc:total fetch ops"); - table.addCell("pri.search.open_contexts", "alias:pso,priSearchOpenContexts;default:false;text-align:right;desc:open search contexts"); - table.addCell("pri.search.query_current", "alias:psqc,priSearchQueryCurrent;default:false;text-align:right;desc:current query phase ops"); - table.addCell("pri.search.query_time", "alias:psqti,priSearchQueryTime;default:false;text-align:right;desc:time spent in query phase"); - table.addCell("pri.search.query_total", "alias:psqto,priSearchQueryTotal;default:false;text-align:right;desc:total query phase ops"); + table.addCell("get.total", "sibling:pri;alias:gto,getTotal;default:false;text-align:right;desc:number of get ops"); + table.addCell("pri.get.total", "default:false;text-align:right;desc:number of get ops"); - table.addCell("pri.segments.count", "alias:psc,priSegmentsCount;default:false;text-align:right;desc:number of segments"); - table.addCell("pri.segments.memory", "alias:psm,priSegmentsMemory;default:false;text-align:right;desc:memory used by segments"); + table.addCell("get.exists_time", "sibling:pri;alias:geti,getExistsTime;default:false;text-align:right;desc:time spent in successful gets"); + table.addCell("pri.get.exists_time", "default:false;text-align:right;desc:time spent in successful gets"); - table.addCell("pri.warmer.current", "alias:pwc,priWarmerCurrent;default:false;text-align:right;desc:current warmer ops"); - table.addCell("pri.warmer.total", "alias:pwto,priWarmerTotal;default:false;text-align:right;desc:total warmer ops"); - table.addCell("pri.warmer.total_time", "alias:pwtt,priWarmerTotalTime;default:false;text-align:right;desc:time spent in warmers"); + table.addCell("get.exists_total", "sibling:pri;alias:geto,getExistsTotal;default:false;text-align:right;desc:number of successful gets"); + table.addCell("pri.get.exists_total", "default:false;text-align:right;desc:number of successful gets"); - table.addCell("completion.size", "alias:cs,completionSize;default:false;text-align:right;desc:size of completion"); + table.addCell("get.missing_time", "sibling:pri;alias:gmti,getMissingTime;default:false;text-align:right;desc:time spent in failed gets"); + table.addCell("pri.get.missing_time", "default:false;text-align:right;desc:time spent in failed gets"); - table.addCell("fielddata.memory_size", "alias:fm,fielddataMemory;default:false;text-align:right;desc:used fielddata cache"); - table.addCell("fielddata.evictions", "alias:fe,fielddataEvictions;default:false;text-align:right;desc:fielddata evictions"); + table.addCell("get.missing_total", "sibling:pri;alias:gmto,getMissingTotal;default:false;text-align:right;desc:number of failed gets"); + table.addCell("pri.get.missing_total", "default:false;text-align:right;desc:number of failed gets"); - table.addCell("filter_cache.memory_size", "alias:fcm,filterCacheMemory;default:false;text-align:right;desc:used filter cache"); - table.addCell("filter_cache.evictions", "alias:fce,filterCacheEvictions;default:false;text-align:right;desc:filter cache evictions"); + table.addCell("id_cache.memory_size", "sibling:pri;alias:im,idCacheMemory;default:false;text-align:right;desc:used id cache"); + table.addCell("pri.id_cache.memory_size", "default:false;text-align:right;desc:used id cache"); - table.addCell("flush.total", "alias:ft,flushTotal;default:false;text-align:right;desc:number of flushes"); - table.addCell("flush.total_time", "alias:ftt,flushTotalTime;default:false;text-align:right;desc:time spent in flush"); + table.addCell("indexing.delete_current", "sibling:pri;alias:idc,indexingDeleteCurrent;default:false;text-align:right;desc:number of current deletions"); + table.addCell("pri.indexing.delete_current", "default:false;text-align:right;desc:number of current deletions"); - table.addCell("get.current", "alias:gc,getCurrent;default:false;text-align:right;desc:number of current get ops"); - table.addCell("get.time", "alias:gti,getTime;default:false;text-align:right;desc:time spent in get"); - table.addCell("get.total", "alias:gto,getTotal;default:false;text-align:right;desc:number of get ops"); - table.addCell("get.exists_time", "alias:geti,getExistsTime;default:false;text-align:right;desc:time spent in successful gets"); - table.addCell("get.exists_total", "alias:geto,getExistsTotal;default:false;text-align:right;desc:number of successful gets"); - table.addCell("get.missing_time", "alias:gmti,getMissingTime;default:false;text-align:right;desc:time spent in failed gets"); - table.addCell("get.missing_total", "alias:gmto,getMissingTotal;default:false;text-align:right;desc:number of failed gets"); + table.addCell("indexing.delete_time", "sibling:pri;alias:idti,indexingDeleteTime;default:false;text-align:right;desc:time spent in deletions"); + table.addCell("pri.indexing.delete_time", "default:false;text-align:right;desc:time spent in deletions"); - table.addCell("id_cache.memory_size", "alias:im,idCacheMemory;default:false;text-align:right;desc:used id cache"); + table.addCell("indexing.delete_total", "sibling:pri;alias:idto,indexingDeleteTotal;default:false;text-align:right;desc:number of delete ops"); + table.addCell("pri.indexing.delete_total", "default:false;text-align:right;desc:number of delete ops"); - table.addCell("indexing.delete_current", "alias:idc,indexingDeleteCurrent;default:false;text-align:right;desc:number of current deletions"); - table.addCell("indexing.delete_time", "alias:idti,indexingDeleteTime;default:false;text-align:right;desc:time spent in deletions"); - table.addCell("indexing.delete_total", "alias:idto,indexingDeleteTotal;default:false;text-align:right;desc:number of delete ops"); - table.addCell("indexing.index_current", "alias:iic,indexingIndexCurrent;default:false;text-align:right;desc:number of current indexing ops"); - table.addCell("indexing.index_time", "alias:iiti,indexingIndexTime;default:false;text-align:right;desc:time spent in indexing"); - table.addCell("indexing.index_total", "alias:iito,indexingIndexTotal;default:false;text-align:right;desc:number of indexing ops"); + table.addCell("indexing.index_current", "sibling:pri;alias:iic,indexingIndexCurrent;default:false;text-align:right;desc:number of current indexing ops"); + table.addCell("pri.indexing.index_current", "default:false;text-align:right;desc:number of current indexing ops"); - table.addCell("merges.current", "alias:mc,mergesCurrent;default:false;text-align:right;desc:number of current merges"); - table.addCell("merges.current_docs", "alias:mcd,mergesCurrentDocs;default:false;text-align:right;desc:number of current merging docs"); - table.addCell("merges.current_size", "alias:mcs,mergesCurrentSize;default:false;text-align:right;desc:size of current merges"); - table.addCell("merges.total", "alias:mt,mergesTotal;default:false;text-align:right;desc:number of completed merge ops"); - table.addCell("merges.total_docs", "alias:mtd,mergesTotalDocs;default:false;text-align:right;desc:docs merged"); - table.addCell("merges.total_size", "alias:mts,mergesTotalSize;default:false;text-align:right;desc:size merged"); - table.addCell("merges.total_time", "alias:mtt,mergesTotalTime;default:false;text-align:right;desc:time spent in merges"); + table.addCell("indexing.index_time", "sibling:pri;alias:iiti,indexingIndexTime;default:false;text-align:right;desc:time spent in indexing"); + table.addCell("pri.indexing.index_time", "default:false;text-align:right;desc:time spent in indexing"); - table.addCell("percolate.current", "alias:pc,percolateCurrent;default:false;text-align:right;desc:number of current percolations"); - table.addCell("percolate.memory_size", "alias:pm,percolateMemory;default:false;text-align:right;desc:memory used by percolations"); - table.addCell("percolate.queries", "alias:pq,percolateQueries;default:false;text-align:right;desc:number of registered percolation queries"); - table.addCell("percolate.time", "alias:pti,percolateTime;default:false;text-align:right;desc:time spent percolating"); - table.addCell("percolate.total", "alias:pto,percolateTotal;default:false;text-align:right;desc:total percolations"); + table.addCell("indexing.index_total", "sibling:pri;alias:iito,indexingIndexTotal;default:false;text-align:right;desc:number of indexing ops"); + table.addCell("pri.indexing.index_total", "default:false;text-align:right;desc:number of indexing ops"); - table.addCell("refresh.total", "alias:rto,refreshTotal;default:false;text-align:right;desc:total refreshes"); - table.addCell("refresh.time", "alias:rti,refreshTime;default:false;text-align:right;desc:time spent in refreshes"); + table.addCell("merges.current", "sibling:pri;alias:mc,mergesCurrent;default:false;text-align:right;desc:number of current merges"); + table.addCell("pri.merges.current", "default:false;text-align:right;desc:number of current merges"); - table.addCell("search.fetch_current", "alias:sfc,searchFetchCurrent;default:false;text-align:right;desc:current fetch phase ops"); - table.addCell("search.fetch_time", "alias:sfti,searchFetchTime;default:false;text-align:right;desc:time spent in fetch phase"); - table.addCell("search.fetch_total", "alias:sfto,searchFetchTotal;default:false;text-align:right;desc:total fetch ops"); - table.addCell("search.open_contexts", "alias:so,searchOpenContexts;default:false;text-align:right;desc:open search contexts"); - table.addCell("search.query_current", "alias:sqc,searchQueryCurrent;default:false;text-align:right;desc:current query phase ops"); - table.addCell("search.query_time", "alias:sqti,searchQueryTime;default:false;text-align:right;desc:time spent in query phase"); - table.addCell("search.query_total", "alias:sqto,searchQueryTotal;default:false;text-align:right;desc:total query phase ops"); + table.addCell("merges.current_docs", "sibling:pri;alias:mcd,mergesCurrentDocs;default:false;text-align:right;desc:number of current merging docs"); + table.addCell("pri.merges.current_docs", "default:false;text-align:right;desc:number of current merging docs"); - table.addCell("segments.count", "alias:sc,segmentsCount;default:false;text-align:right;desc:number of segments"); - table.addCell("segments.memory", "alias:sm,segmentsMemory;default:false;text-align:right;desc:memory used by segments"); + table.addCell("merges.current_size", "sibling:pri;alias:mcs,mergesCurrentSize;default:false;text-align:right;desc:size of current merges"); + table.addCell("pri.merges.current_size", "default:false;text-align:right;desc:size of current merges"); - table.addCell("warmer.current", "alias:wc,warmerCurrent;default:false;text-align:right;desc:current warmer ops"); - table.addCell("warmer.total", "alias:wto,warmerTotal;default:false;text-align:right;desc:total warmer ops"); - table.addCell("warmer.total_time", "alias:wtt,warmerTotalTime;default:false;text-align:right;desc:time spent in warmers"); + table.addCell("merges.total", "sibling:pri;alias:mt,mergesTotal;default:false;text-align:right;desc:number of completed merge ops"); + table.addCell("pri.merges.total", "default:false;text-align:right;desc:number of completed merge ops"); + + table.addCell("merges.total_docs", "sibling:pri;alias:mtd,mergesTotalDocs;default:false;text-align:right;desc:docs merged"); + table.addCell("pri.merges.total_docs", "default:false;text-align:right;desc:docs merged"); + + table.addCell("merges.total_size", "sibling:pri;alias:mts,mergesTotalSize;default:false;text-align:right;desc:size merged"); + table.addCell("pri.merges.total_size", "default:false;text-align:right;desc:size merged"); + + table.addCell("merges.total_time", "sibling:pri;alias:mtt,mergesTotalTime;default:false;text-align:right;desc:time spent in merges"); + table.addCell("pri.merges.total_time", "default:false;text-align:right;desc:time spent in merges"); + + table.addCell("percolate.current", "sibling:pri;alias:pc,percolateCurrent;default:false;text-align:right;desc:number of current percolations"); + table.addCell("pri.percolate.current", "default:false;text-align:right;desc:number of current percolations"); + + table.addCell("percolate.memory_size", "sibling:pri;alias:pm,percolateMemory;default:false;text-align:right;desc:memory used by percolations"); + table.addCell("pri.percolate.memory_size", "default:false;text-align:right;desc:memory used by percolations"); + + table.addCell("percolate.queries", "sibling:pri;alias:pq,percolateQueries;default:false;text-align:right;desc:number of registered percolation queries"); + table.addCell("pri.percolate.queries", "default:false;text-align:right;desc:number of registered percolation queries"); + + table.addCell("percolate.time", "sibling:pri;alias:pti,percolateTime;default:false;text-align:right;desc:time spent percolating"); + table.addCell("pri.percolate.time", "default:false;text-align:right;desc:time spent percolating"); + + table.addCell("percolate.total", "sibling:pri;alias:pto,percolateTotal;default:false;text-align:right;desc:total percolations"); + table.addCell("pri.percolate.total", "default:false;text-align:right;desc:total percolations"); + + table.addCell("refresh.total", "sibling:pri;alias:rto,refreshTotal;default:false;text-align:right;desc:total refreshes"); + table.addCell("pri.refresh.total", "default:false;text-align:right;desc:total refreshes"); + + table.addCell("refresh.time", "sibling:pri;alias:rti,refreshTime;default:false;text-align:right;desc:time spent in refreshes"); + table.addCell("pri.refresh.time", "default:false;text-align:right;desc:time spent in refreshes"); + + table.addCell("search.fetch_current", "sibling:pri;alias:sfc,searchFetchCurrent;default:false;text-align:right;desc:current fetch phase ops"); + table.addCell("pri.search.fetch_current", "default:false;text-align:right;desc:current fetch phase ops"); + + table.addCell("search.fetch_time", "sibling:pri;alias:sfti,searchFetchTime;default:false;text-align:right;desc:time spent in fetch phase"); + table.addCell("pri.search.fetch_time", "default:false;text-align:right;desc:time spent in fetch phase"); + + table.addCell("search.fetch_total", "sibling:pri;alias:sfto,searchFetchTotal;default:false;text-align:right;desc:total fetch ops"); + table.addCell("pri.search.fetch_total", "default:false;text-align:right;desc:total fetch ops"); + + table.addCell("search.open_contexts", "sibling:pri;alias:so,searchOpenContexts;default:false;text-align:right;desc:open search contexts"); + table.addCell("pri.search.open_contexts", "default:false;text-align:right;desc:open search contexts"); + + table.addCell("search.query_current", "sibling:pri;alias:sqc,searchQueryCurrent;default:false;text-align:right;desc:current query phase ops"); + table.addCell("pri.search.query_current", "default:false;text-align:right;desc:current query phase ops"); + + table.addCell("search.query_time", "sibling:pri;alias:sqti,searchQueryTime;default:false;text-align:right;desc:time spent in query phase"); + table.addCell("pri.search.query_time", "default:false;text-align:right;desc:time spent in query phase"); + + table.addCell("search.query_total", "sibling:pri;alias:sqto,searchQueryTotal;default:false;text-align:right;desc:total query phase ops"); + table.addCell("pri.search.query_total", "default:false;text-align:right;desc:total query phase ops"); + + table.addCell("segments.count", "sibling:pri;alias:sc,segmentsCount;default:false;text-align:right;desc:number of segments"); + table.addCell("pri.segments.count", "default:false;text-align:right;desc:number of segments"); + + table.addCell("segments.memory", "sibling:pri;alias:sm,segmentsMemory;default:false;text-align:right;desc:memory used by segments"); + table.addCell("pri.segments.memory", "default:false;text-align:right;desc:memory used by segments"); + + table.addCell("warmer.current", "sibling:pri;alias:wc,warmerCurrent;default:false;text-align:right;desc:current warmer ops"); + table.addCell("pri.warmer.current", "default:false;text-align:right;desc:current warmer ops"); + + table.addCell("warmer.total", "sibling:pri;alias:wto,warmerTotal;default:false;text-align:right;desc:total warmer ops"); + table.addCell("pri.warmer.total", "default:false;text-align:right;desc:total warmer ops"); + + table.addCell("warmer.total_time", "sibling:pri;alias:wtt,warmerTotalTime;default:false;text-align:right;desc:time spent in warmers"); + table.addCell("pri.warmer.total_time", "default:false;text-align:right;desc:time spent in warmers"); table.endHeaders(); return table; @@ -273,128 +295,150 @@ public class RestIndicesAction extends AbstractCatAction { table.addCell(indexHealth == null ? null : indexHealth.getNumberOfReplicas()); table.addCell(indexStats == null ? null : indexStats.getPrimaries().getDocs().getCount()); table.addCell(indexStats == null ? null : indexStats.getPrimaries().getDocs().getDeleted()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getStore().size()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getStore().size()); - - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getCompletion().getSize()); - - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getFieldData().getMemorySize()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getFieldData().getEvictions()); - - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getFilterCache().getMemorySize()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getFilterCache().getEvictions()); - - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getFlush().getTotal()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getFlush().getTotalTime()); - - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getGet().current()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getGet().getTime()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getGet().getCount()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getGet().getExistsTime()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getGet().getExistsCount()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getGet().getMissingTime()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getGet().getMissingCount()); - - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getIdCache().getMemorySize()); - - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getIndexing().getTotal().getDeleteCurrent()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getIndexing().getTotal().getDeleteTime()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getIndexing().getTotal().getDeleteCount()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getIndexing().getTotal().getIndexCurrent()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getIndexing().getTotal().getIndexTime()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getIndexing().getTotal().getIndexCount()); - - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getMerge().getCurrent()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getMerge().getCurrentNumDocs()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getMerge().getCurrentSize()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getMerge().getTotal()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getMerge().getTotalNumDocs()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getMerge().getTotalSize()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getMerge().getTotalTime()); - - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getPercolate().getCurrent()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getPercolate().getMemorySize()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getPercolate().getNumQueries()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getPercolate().getTime()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getPercolate().getCount()); - - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getRefresh().getTotal()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getRefresh().getTotalTime()); - - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getSearch().getTotal().getFetchCurrent()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getSearch().getTotal().getFetchTime()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getSearch().getTotal().getFetchCount()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getSearch().getOpenContexts()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getSearch().getTotal().getQueryCurrent()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getSearch().getTotal().getQueryTime()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getSearch().getTotal().getQueryCount()); - - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getSegments().getCount()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getSegments().getMemory()); - - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getWarmer().current()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getWarmer().total()); - table.addCell(indexStats == null ? null : indexStats.getPrimaries().getWarmer().totalTime()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getStore().size()); table.addCell(indexStats == null ? null : indexStats.getTotal().getCompletion().getSize()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getCompletion().getSize()); table.addCell(indexStats == null ? null : indexStats.getTotal().getFieldData().getMemorySize()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getFieldData().getMemorySize()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getFieldData().getEvictions()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getFieldData().getEvictions()); table.addCell(indexStats == null ? null : indexStats.getTotal().getFilterCache().getMemorySize()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getFilterCache().getMemorySize()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getFilterCache().getEvictions()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getFilterCache().getEvictions()); table.addCell(indexStats == null ? null : indexStats.getTotal().getFlush().getTotal()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getFlush().getTotal()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getFlush().getTotalTime()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getFlush().getTotalTime()); table.addCell(indexStats == null ? null : indexStats.getTotal().getGet().current()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getGet().current()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getGet().getTime()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getGet().getTime()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getGet().getCount()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getGet().getCount()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getGet().getExistsTime()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getGet().getExistsTime()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getGet().getExistsCount()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getGet().getExistsCount()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getGet().getMissingTime()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getGet().getMissingTime()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getGet().getMissingCount()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getGet().getMissingCount()); table.addCell(indexStats == null ? null : indexStats.getTotal().getIdCache().getMemorySize()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getIdCache().getMemorySize()); table.addCell(indexStats == null ? null : indexStats.getTotal().getIndexing().getTotal().getDeleteCurrent()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getIndexing().getTotal().getDeleteCurrent()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getIndexing().getTotal().getDeleteTime()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getIndexing().getTotal().getDeleteTime()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getIndexing().getTotal().getDeleteCount()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getIndexing().getTotal().getDeleteCount()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getIndexing().getTotal().getIndexCurrent()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getIndexing().getTotal().getIndexCurrent()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getIndexing().getTotal().getIndexTime()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getIndexing().getTotal().getIndexTime()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getIndexing().getTotal().getIndexCount()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getIndexing().getTotal().getIndexCount()); table.addCell(indexStats == null ? null : indexStats.getTotal().getMerge().getCurrent()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getMerge().getCurrentSize()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getMerge().getCurrentNumDocs()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getMerge().getCurrentNumDocs()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getMerge().getCurrentSize()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getMerge().getCurrent()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getMerge().getTotal()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getMerge().getTotal()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getMerge().getTotalNumDocs()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getMerge().getTotalNumDocs()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getMerge().getTotalSize()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getMerge().getTotalSize()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getMerge().getTotalTime()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getMerge().getTotalTime()); table.addCell(indexStats == null ? null : indexStats.getTotal().getPercolate().getCurrent()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getPercolate().getCurrent()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getPercolate().getMemorySize()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getPercolate().getMemorySize()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getPercolate().getNumQueries()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getPercolate().getNumQueries()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getPercolate().getTime()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getPercolate().getTime()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getPercolate().getCount()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getPercolate().getCount()); table.addCell(indexStats == null ? null : indexStats.getTotal().getRefresh().getTotal()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getRefresh().getTotal()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getRefresh().getTotalTime()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getRefresh().getTotalTime()); table.addCell(indexStats == null ? null : indexStats.getTotal().getSearch().getTotal().getFetchCurrent()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getSearch().getTotal().getFetchCurrent()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getSearch().getTotal().getFetchTime()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getSearch().getTotal().getFetchTime()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getSearch().getTotal().getFetchCount()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getSearch().getTotal().getFetchCount()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getSearch().getOpenContexts()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getSearch().getOpenContexts()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getSearch().getTotal().getQueryCurrent()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getSearch().getTotal().getQueryCurrent()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getSearch().getTotal().getQueryTime()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getSearch().getTotal().getQueryTime()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getSearch().getTotal().getQueryCount()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getSearch().getTotal().getQueryCount()); table.addCell(indexStats == null ? null : indexStats.getTotal().getSegments().getCount()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getSegments().getCount()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getSegments().getMemory()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getSegments().getMemory()); table.addCell(indexStats == null ? null : indexStats.getTotal().getWarmer().current()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getWarmer().current()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getWarmer().total()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getWarmer().total()); + table.addCell(indexStats == null ? null : indexStats.getTotal().getWarmer().totalTime()); + table.addCell(indexStats == null ? null : indexStats.getPrimaries().getWarmer().totalTime()); table.endRow(); } diff --git a/src/main/java/org/elasticsearch/rest/action/support/RestTable.java b/src/main/java/org/elasticsearch/rest/action/support/RestTable.java index 3b7cefbe834..c263b45261a 100644 --- a/src/main/java/org/elasticsearch/rest/action/support/RestTable.java +++ b/src/main/java/org/elasticsearch/rest/action/support/RestTable.java @@ -94,21 +94,40 @@ public class RestTable { List display = new ArrayList(); if (pHeaders != null) { for (String possibility : Strings.splitStringByCommaToArray(pHeaders)) { + DisplayHeader dispHeader = null; + if (table.getAsMap().containsKey(possibility)) { - display.add(new DisplayHeader(possibility, possibility)); + dispHeader = new DisplayHeader(possibility, possibility); } else { for (Table.Cell headerCell : table.getHeaders()) { String aliases = headerCell.attr.get("alias"); if (aliases != null) { for (String alias : Strings.splitStringByCommaToArray(aliases)) { if (possibility.equals(alias)) { - display.add(new DisplayHeader(headerCell.value.toString(), alias)); + dispHeader = new DisplayHeader(headerCell.value.toString(), alias); break; } } } } } + + if (dispHeader != null) { + // We know we need the header asked for: + display.add(dispHeader); + + // Look for accompanying sibling column + Table.Cell hcell = table.getHeaderMap().get(dispHeader.name); + String siblingFlag = hcell.attr.get("sibling"); + if (siblingFlag != null) { + // ...link the sibling and check that its flag is set + String sibling = siblingFlag + "." + dispHeader.name; + Table.Cell c = table.getHeaderMap().get(sibling); + if (c != null && request.paramAsBoolean(siblingFlag, false)) { + display.add(new DisplayHeader(c.value.toString(), siblingFlag + "." + dispHeader.display)); + } + } + } } } else { for (Table.Cell cell : table.getHeaders()) {