Skip to content

Commit 41d7e3a

Browse files
authored
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
1 parent ff7df40 commit 41d7e3a

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

docs/reference/frozen-indices.asciidoc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,24 @@ The default value for `pre_filter_shard_size` is `128` but it's recommended to s
6464
significant overhead associated with this pre-filter phase.
6565
================================
6666

67+
== Monitoring frozen indices
68+
69+
Frozen indices are ordinary indices that use search throttling and a memory efficient shard implementation. For API's like the
70+
`<<cat-indices>>` frozen indicies may identified by an index's `search.throttled` property (`sth`).
71+
72+
[source,js]
73+
--------------------------------------------------
74+
GET /_cat/indices/twitter?v&h=i,sth
75+
--------------------------------------------------
76+
// CONSOLE
77+
// TEST[s/^/PUT twitter\nPOST twitter\/_freeze\n/]
78+
79+
The response looks like:
80+
81+
[source,txt]
82+
--------------------------------------------------
83+
i sth
84+
twitter true
85+
--------------------------------------------------
86+
// TESTRESPONSE[_cat]
6787

server/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import org.elasticsearch.common.settings.Settings;
4242
import org.elasticsearch.common.time.DateFormatters;
4343
import org.elasticsearch.index.Index;
44+
import org.elasticsearch.index.IndexSettings;
4445
import org.elasticsearch.rest.RestController;
4546
import org.elasticsearch.rest.RestRequest;
4647
import org.elasticsearch.rest.RestResponse;
@@ -335,6 +336,8 @@ protected Table getTableWithHeader(final RestRequest request) {
335336
table.addCell("memory.total", "sibling:pri;alias:tm,memoryTotal;default:false;text-align:right;desc:total used memory");
336337
table.addCell("pri.memory.total", "default:false;text-align:right;desc:total user memory");
337338

339+
table.addCell("search.throttled", "alias:sth;default:false;desc:indicates if the index is search throttled");
340+
338341
table.endHeaders();
339342
return table;
340343
}
@@ -357,6 +360,7 @@ Table buildTable(RestRequest request, Index[] indices, ClusterHealthResponse res
357360
IndexStats indexStats = stats.getIndices().get(indexName);
358361
IndexMetaData indexMetaData = indexMetaDatas.getIndices().get(indexName);
359362
IndexMetaData.State state = indexMetaData.getState();
363+
boolean searchThrottled = IndexSettings.INDEX_SEARCH_THROTTLED.get(indexMetaData.getSettings());
360364

361365
if (status != null) {
362366
if (state == IndexMetaData.State.CLOSE ||
@@ -558,6 +562,8 @@ Table buildTable(RestRequest request, Index[] indices, ClusterHealthResponse res
558562
table.addCell(indexStats == null ? null : indexStats.getTotal().getTotalMemory());
559563
table.addCell(indexStats == null ? null : indexStats.getPrimaries().getTotalMemory());
560564

565+
table.addCell(searchThrottled);
566+
561567
table.endRow();
562568
}
563569

0 commit comments

Comments
 (0)