From 41d7e3a2fe9de55de45e55426ffcb74b96775653 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Fri, 4 Jan 2019 13:49:40 +0100 Subject: [PATCH] Expose `search.throttled` on `_cat/indices` (#37073) Today it's very difficult to see which indices are frozen or rather throttled via the commonly used monitoring APIs. This change adds a cell to the `_cat/indices` API to render if an index is `search.throttled` Relates to #34352 --- docs/reference/frozen-indices.asciidoc | 20 +++++++++++++++++++ .../rest/action/cat/RestIndicesAction.java | 6 ++++++ 2 files changed, 26 insertions(+) diff --git a/docs/reference/frozen-indices.asciidoc b/docs/reference/frozen-indices.asciidoc index 4002df887665d..19a8e4318b0c2 100644 --- a/docs/reference/frozen-indices.asciidoc +++ b/docs/reference/frozen-indices.asciidoc @@ -64,4 +64,24 @@ The default value for `pre_filter_shard_size` is `128` but it's recommended to s significant overhead associated with this pre-filter phase. ================================ +== Monitoring frozen indices + +Frozen indices are ordinary indices that use search throttling and a memory efficient shard implementation. For API's like the +`<>` frozen indicies may identified by an index's `search.throttled` property (`sth`). + +[source,js] +-------------------------------------------------- +GET /_cat/indices/twitter?v&h=i,sth +-------------------------------------------------- +// CONSOLE +// TEST[s/^/PUT twitter\nPOST twitter\/_freeze\n/] + +The response looks like: + +[source,txt] +-------------------------------------------------- +i sth +twitter true +-------------------------------------------------- +// TESTRESPONSE[_cat] diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java index 1a859933ad3fe..fc2fa9a34e5f6 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java @@ -41,6 +41,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.time.DateFormatters; import org.elasticsearch.index.Index; +import org.elasticsearch.index.IndexSettings; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; @@ -335,6 +336,8 @@ protected Table getTableWithHeader(final RestRequest request) { 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.addCell("search.throttled", "alias:sth;default:false;desc:indicates if the index is search throttled"); + table.endHeaders(); return table; } @@ -357,6 +360,7 @@ Table buildTable(RestRequest request, Index[] indices, ClusterHealthResponse res IndexStats indexStats = stats.getIndices().get(indexName); IndexMetaData indexMetaData = indexMetaDatas.getIndices().get(indexName); IndexMetaData.State state = indexMetaData.getState(); + boolean searchThrottled = IndexSettings.INDEX_SEARCH_THROTTLED.get(indexMetaData.getSettings()); if (status != null) { if (state == IndexMetaData.State.CLOSE || @@ -558,6 +562,8 @@ Table buildTable(RestRequest request, Index[] indices, ClusterHealthResponse res table.addCell(indexStats == null ? null : indexStats.getTotal().getTotalMemory()); table.addCell(indexStats == null ? null : indexStats.getPrimaries().getTotalMemory()); + table.addCell(searchThrottled); + table.endRow(); }