Search in sources :

Example 46 with Table

use of org.elasticsearch.common.Table in project elasticsearch by elastic.

the class RestHealthAction method getTableWithHeader.

@Override
protected Table getTableWithHeader(final RestRequest request) {
    Table t = new Table();
    t.startHeadersWithTimestamp();
    t.addCell("cluster", "alias:cl;desc:cluster name");
    t.addCell("status", "alias:st;desc:health status");
    t.addCell("node.total", "alias:nt,nodeTotal;text-align:right;desc:total number of nodes");
    t.addCell("node.data", "alias:nd,nodeData;text-align:right;desc:number of nodes that can store data");
    t.addCell("shards", "alias:t,sh,shards.total,shardsTotal;text-align:right;desc:total number of shards");
    t.addCell("pri", "alias:p,shards.primary,shardsPrimary;text-align:right;desc:number of primary shards");
    t.addCell("relo", "alias:r,shards.relocating,shardsRelocating;text-align:right;desc:number of relocating nodes");
    t.addCell("init", "alias:i,shards.initializing,shardsInitializing;text-align:right;desc:number of initializing nodes");
    t.addCell("unassign", "alias:u,shards.unassigned,shardsUnassigned;text-align:right;desc:number of unassigned shards");
    t.addCell("pending_tasks", "alias:pt,pendingTasks;text-align:right;desc:number of pending tasks");
    t.addCell("max_task_wait_time", "alias:mtwt,maxTaskWaitTime;text-align:right;desc:wait time of longest task pending");
    t.addCell("active_shards_percent", "alias:asp,activeShardsPercent;text-align:right;desc:active number of shards in percent");
    t.endHeaders();
    return t;
}
Also used : Table(org.elasticsearch.common.Table)

Example 47 with Table

use of org.elasticsearch.common.Table in project elasticsearch by elastic.

the class RestHealthAction method buildTable.

private Table buildTable(final ClusterHealthResponse health, final RestRequest request) {
    Table t = getTableWithHeader(request);
    t.startRow();
    t.addCell(health.getClusterName());
    t.addCell(health.getStatus().name().toLowerCase(Locale.ROOT));
    t.addCell(health.getNumberOfNodes());
    t.addCell(health.getNumberOfDataNodes());
    t.addCell(health.getActiveShards());
    t.addCell(health.getActivePrimaryShards());
    t.addCell(health.getRelocatingShards());
    t.addCell(health.getInitializingShards());
    t.addCell(health.getUnassignedShards());
    t.addCell(health.getNumberOfPendingTasks());
    t.addCell(health.getTaskMaxWaitingTime().millis() == 0 ? "-" : health.getTaskMaxWaitingTime());
    t.addCell(String.format(Locale.ROOT, "%1.1f%%", health.getActiveShardsPercent()));
    t.endRow();
    return t;
}
Also used : Table(org.elasticsearch.common.Table)

Example 48 with Table

use of org.elasticsearch.common.Table in project elasticsearch by elastic.

the class RestIndicesAction method getTableWithHeader.

@Override
protected Table getTableWithHeader(final RestRequest request) {
    Table table = new Table();
    table.startHeaders();
    table.addCell("health", "alias:h;desc:current health status");
    table.addCell("status", "alias:s;desc:open/close status");
    table.addCell("index", "alias:i,idx;desc:index name");
    table.addCell("uuid", "alias:id,uuid;desc:index uuid");
    table.addCell("pri", "alias:p,shards.primary,shardsPrimary;text-align:right;desc:number of primary shards");
    table.addCell("rep", "alias:r,shards.replica,shardsReplica;text-align:right;desc:number of replica shards");
    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");
    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("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("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("query_cache.memory_size", "sibling:pri;alias:qcm,queryCacheMemory;default:false;text-align:right;desc:used query cache");
    table.addCell("pri.query_cache.memory_size", "default:false;text-align:right;desc:used query cache");
    table.addCell("query_cache.evictions", "sibling:pri;alias:qce,queryCacheEvictions;default:false;text-align:right;desc:query cache evictions");
    table.addCell("pri.query_cache.evictions", "default:false;text-align:right;desc:query cache evictions");
    table.addCell("request_cache.memory_size", "sibling:pri;alias:rcm,requestCacheMemory;default:false;text-align:right;desc:used request cache");
    table.addCell("pri.request_cache.memory_size", "default:false;text-align:right;desc:used request cache");
    table.addCell("request_cache.evictions", "sibling:pri;alias:rce,requestCacheEvictions;default:false;text-align:right;desc:request cache evictions");
    table.addCell("pri.request_cache.evictions", "default:false;text-align:right;desc:request cache evictions");
    table.addCell("request_cache.hit_count", "sibling:pri;alias:rchc,requestCacheHitCount;default:false;text-align:right;desc:request cache hit count");
    table.addCell("pri.request_cache.hit_count", "default:false;text-align:right;desc:request cache hit count");
    table.addCell("request_cache.miss_count", "sibling:pri;alias:rcmc,requestCacheMissCount;default:false;text-align:right;desc:request cache miss count");
    table.addCell("pri.request_cache.miss_count", "default:false;text-align:right;desc:request cache miss count");
    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("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("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("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("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("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("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("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("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("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("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("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.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("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("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("indexing.index_failed", "sibling:pri;alias:iif,indexingIndexFailed;default:false;text-align:right;desc:number of failed indexing ops");
    table.addCell("pri.indexing.index_failed", "default:false;text-align:right;desc:number of failed indexing ops");
    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("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("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("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("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("refresh.listeners", "sibling:pri;alias:rli,refreshListeners;default:false;text-align:right;desc:number of pending refresh listeners");
    table.addCell("pri.refresh.listeners", "default:false;text-align:right;desc:number of pending refresh listeners");
    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("search.scroll_current", "sibling:pri;alias:scc,searchScrollCurrent;default:false;text-align:right;desc:open scroll contexts");
    table.addCell("pri.search.scroll_current", "default:false;text-align:right;desc:open scroll contexts");
    table.addCell("search.scroll_time", "sibling:pri;alias:scti,searchScrollTime;default:false;text-align:right;desc:time scroll contexts held open");
    table.addCell("pri.search.scroll_time", "default:false;text-align:right;desc:time scroll contexts held open");
    table.addCell("search.scroll_total", "sibling:pri;alias:scto,searchScrollTotal;default:false;text-align:right;desc:completed scroll contexts");
    table.addCell("pri.search.scroll_total", "default:false;text-align:right;desc:completed scroll contexts");
    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("segments.index_writer_memory", "sibling:pri;alias:siwm,segmentsIndexWriterMemory;default:false;text-align:right;desc:memory used by index writer");
    table.addCell("pri.segments.index_writer_memory", "default:false;text-align:right;desc:memory used by index writer");
    table.addCell("segments.version_map_memory", "sibling:pri;alias:svmm,segmentsVersionMapMemory;default:false;text-align:right;desc:memory used by version map");
    table.addCell("pri.segments.version_map_memory", "default:false;text-align:right;desc:memory used by version map");
    table.addCell("segments.fixed_bitset_memory", "sibling:pri;alias:sfbm,fixedBitsetMemory;default:false;text-align:right;desc:memory used by fixed bit sets for nested object field types and type filters for types referred in _parent fields");
    table.addCell("pri.segments.fixed_bitset_memory", "default:false;text-align:right;desc:memory used by fixed bit sets for nested object field types and type filters for types referred in _parent fields");
    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.addCell("suggest.current", "sibling:pri;alias:suc,suggestCurrent;default:false;text-align:right;desc:number of current suggest ops");
    table.addCell("pri.suggest.current", "default:false;text-align:right;desc:number of current suggest ops");
    table.addCell("suggest.time", "sibling:pri;alias:suti,suggestTime;default:false;text-align:right;desc:time spend in suggest");
    table.addCell("pri.suggest.time", "default:false;text-align:right;desc:time spend in suggest");
    table.addCell("suggest.total", "sibling:pri;alias:suto,suggestTotal;default:false;text-align:right;desc:number of suggest ops");
    table.addCell("pri.suggest.total", "default:false;text-align:right;desc:number of suggest ops");
    table.addCell("memory.total", "sibling:pri;alias:tm,memoryTotal;default:false;text-align:right;desc:total used memory");
    table.addCell("pri.memory.total", "default:false;text-align:right;desc:total user memory");
    table.endHeaders();
    return table;
}
Also used : Table(org.elasticsearch.common.Table)

Example 49 with Table

use of org.elasticsearch.common.Table in project elasticsearch by elastic.

the class RestSnapshotAction method buildTable.

private Table buildTable(RestRequest req, GetSnapshotsResponse getSnapshotsResponse) {
    Table table = getTableWithHeader(req);
    for (SnapshotInfo snapshotStatus : getSnapshotsResponse.getSnapshots()) {
        table.startRow();
        table.addCell(snapshotStatus.snapshotId().getName());
        table.addCell(snapshotStatus.state());
        table.addCell(TimeUnit.SECONDS.convert(snapshotStatus.startTime(), TimeUnit.MILLISECONDS));
        table.addCell(dateFormat.print(snapshotStatus.startTime()));
        table.addCell(TimeUnit.SECONDS.convert(snapshotStatus.endTime(), TimeUnit.MILLISECONDS));
        table.addCell(dateFormat.print(snapshotStatus.endTime()));
        final long durationMillis;
        if (snapshotStatus.state() == SnapshotState.IN_PROGRESS) {
            durationMillis = System.currentTimeMillis() - snapshotStatus.startTime();
        } else {
            durationMillis = snapshotStatus.endTime() - snapshotStatus.startTime();
        }
        table.addCell(TimeValue.timeValueMillis(durationMillis));
        table.addCell(snapshotStatus.indices().size());
        table.addCell(snapshotStatus.successfulShards());
        table.addCell(snapshotStatus.failedShards());
        table.addCell(snapshotStatus.totalShards());
        table.addCell(snapshotStatus.reason());
        table.endRow();
    }
    return table;
}
Also used : SnapshotInfo(org.elasticsearch.snapshots.SnapshotInfo) Table(org.elasticsearch.common.Table)

Example 50 with Table

use of org.elasticsearch.common.Table in project elasticsearch by elastic.

the class RestTable method buildTextPlainResponse.

public static RestResponse buildTextPlainResponse(Table table, RestChannel channel) throws IOException {
    RestRequest request = channel.request();
    boolean verbose = request.paramAsBoolean("v", false);
    List<DisplayHeader> headers = buildDisplayHeaders(table, request);
    int[] width = buildWidths(table, request, verbose, headers);
    BytesStreamOutput bytesOut = channel.bytesOutput();
    UTF8StreamWriter out = new UTF8StreamWriter().setOutput(bytesOut);
    int lastHeader = headers.size() - 1;
    if (verbose) {
        for (int col = 0; col < headers.size(); col++) {
            DisplayHeader header = headers.get(col);
            boolean isLastColumn = col == lastHeader;
            pad(new Table.Cell(header.display, table.findHeaderByName(header.name)), width[col], request, out, isLastColumn);
            if (!isLastColumn) {
                out.append(" ");
            }
        }
        out.append("\n");
    }
    List<Integer> rowOrder = getRowOrder(table, request);
    for (Integer row : rowOrder) {
        for (int col = 0; col < headers.size(); col++) {
            DisplayHeader header = headers.get(col);
            boolean isLastColumn = col == lastHeader;
            pad(table.getAsMap().get(header.name).get(row), width[col], request, out, isLastColumn);
            if (!isLastColumn) {
                out.append(" ");
            }
        }
        out.append("\n");
    }
    out.close();
    return new BytesRestResponse(RestStatus.OK, BytesRestResponse.TEXT_CONTENT_TYPE, bytesOut.bytes());
}
Also used : Table(org.elasticsearch.common.Table) BytesStreamOutput(org.elasticsearch.common.io.stream.BytesStreamOutput) RestRequest(org.elasticsearch.rest.RestRequest) UTF8StreamWriter(org.elasticsearch.common.io.UTF8StreamWriter) BytesRestResponse(org.elasticsearch.rest.BytesRestResponse)

Aggregations

Table (org.elasticsearch.common.Table)54 Settings (org.elasticsearch.common.settings.Settings)9 DiscoveryNode (org.elasticsearch.cluster.node.DiscoveryNode)8 RestController (org.elasticsearch.rest.RestController)8 NodeClient (org.elasticsearch.client.node.NodeClient)7 DiscoveryNodes (org.elasticsearch.cluster.node.DiscoveryNodes)7 RestRequest (org.elasticsearch.rest.RestRequest)7 GET (org.elasticsearch.rest.RestRequest.Method.GET)6 List (java.util.List)5 NodeStats (org.elasticsearch.action.admin.cluster.node.stats.NodeStats)5 NodeInfo (org.elasticsearch.action.admin.cluster.node.info.NodeInfo)4 IndexMetaData (org.elasticsearch.cluster.metadata.IndexMetaData)4 Strings (org.elasticsearch.common.Strings)4 RestResponse (org.elasticsearch.rest.RestResponse)4 RestResponseListener (org.elasticsearch.rest.action.RestResponseListener)4 HashMap (java.util.HashMap)3 Map (java.util.Map)3 ClusterStateRequest (org.elasticsearch.action.admin.cluster.state.ClusterStateRequest)3 ClusterStateResponse (org.elasticsearch.action.admin.cluster.state.ClusterStateResponse)3 MetaData (org.elasticsearch.cluster.metadata.MetaData)3