This has no practical impact on users since frozen indices are the only throttled indices today. However this has an impact on upcoming features that would use search throttling. Filtering out throttled indices made sense a couple years ago, but as we're now improving support for slow requests with `_async_search` and exploring ways to reduce storage costs, this feature has most likely become a trap, that we'd like to not have with upcoming features that would use search throttling. Relates #54058
This commit is contained in:
parent
3f2d10d8fc
commit
58c3bb5ae1
|
@ -381,7 +381,7 @@ end::if_seq_no[]
|
|||
tag::ignore_throttled[]
|
||||
`ignore_throttled`::
|
||||
(Optional, boolean) If `true`, concrete, expanded or aliased indices are
|
||||
ignored when throttled.
|
||||
ignored when frozen.
|
||||
end::ignore_throttled[]
|
||||
|
||||
tag::index-ignore-unavailable[]
|
||||
|
|
|
@ -71,7 +71,7 @@ Defaults to `open`.
|
|||
|
||||
`ignore_throttled`::
|
||||
(Optional, boolean)
|
||||
If `true`, concrete, expanded or aliased indices are ignored when throttled.
|
||||
If `true`, concrete, expanded or aliased indices are ignored when frozen.
|
||||
Defaults to `false`.
|
||||
|
||||
include::{docdir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
|
||||
|
|
|
@ -96,7 +96,7 @@ Defaults to `open`.
|
|||
|
||||
`ignore_throttled`::
|
||||
(Optional, boolean) If `true`, concrete, expanded or aliased indices will be
|
||||
ignored when throttled. Defaults to `false`.
|
||||
ignored when frozen. Defaults to `false`.
|
||||
|
||||
include::{docdir}/rest-api/common-parms.asciidoc[tag=index-ignore-unavailable]
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.elasticsearch.common.time.DateUtils;
|
|||
import org.elasticsearch.common.util.set.Sets;
|
||||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.index.IndexNotFoundException;
|
||||
import org.elasticsearch.index.IndexSettings;
|
||||
import org.elasticsearch.indices.IndexClosedException;
|
||||
import org.elasticsearch.indices.InvalidIndexNameException;
|
||||
|
||||
|
@ -266,7 +265,12 @@ public class IndexNameExpressionResolver {
|
|||
}
|
||||
|
||||
private static boolean addIndex(IndexMetadata metadata, Context context) {
|
||||
return (context.options.ignoreThrottled() && IndexSettings.INDEX_SEARCH_THROTTLED.get(metadata.getSettings())) == false;
|
||||
// This used to check the `index.search.throttled` setting, but we eventually decided that it was
|
||||
// trappy to hide throttled indices by default. In order to avoid breaking backward compatibility,
|
||||
// we changed it to look at the `index.frozen` setting instead, since frozen indices were the only
|
||||
// type of index to use the `search_throttled` threadpool at that time.
|
||||
// NOTE: We can't reference the Setting object, which is only defined and registered in x-pack.
|
||||
return (context.options.ignoreThrottled() && metadata.getSettings().getAsBoolean("index.frozen", false)) == false;
|
||||
}
|
||||
|
||||
private static IllegalArgumentException aliasesNotSupportedException(String expression) {
|
||||
|
|
|
@ -1700,12 +1700,13 @@ public class IndexNameExpressionResolverTests extends ESTestCase {
|
|||
|
||||
public void testIgnoreThrottled() {
|
||||
Metadata.Builder mdBuilder = Metadata.builder()
|
||||
.put(indexBuilder("test-index", Settings.builder().put(IndexSettings.INDEX_SEARCH_THROTTLED.getKey(), true).build())
|
||||
.put(indexBuilder("test-index", Settings.builder().put("index.frozen", true).build())
|
||||
.state(State.OPEN)
|
||||
.putAlias(AliasMetadata.builder("test-alias")))
|
||||
.put(indexBuilder("index").state(State.OPEN)
|
||||
.put(indexBuilder("index", Settings.builder().put(IndexSettings.INDEX_SEARCH_THROTTLED.getKey(), true).build())
|
||||
.state(State.OPEN)
|
||||
.putAlias(AliasMetadata.builder("test-alias2")))
|
||||
.put(indexBuilder("index-closed", Settings.builder().put(IndexSettings.INDEX_SEARCH_THROTTLED.getKey(), true).build())
|
||||
.put(indexBuilder("index-closed", Settings.builder().put("index.frozen", true).build())
|
||||
.state(State.CLOSE)
|
||||
.putAlias(AliasMetadata.builder("test-alias-closed")));
|
||||
ClusterState state = ClusterState.builder(new ClusterName("_name")).metadata(mdBuilder).build();
|
||||
|
|
|
@ -769,6 +769,19 @@ public class SearchServiceTests extends ESSingleNodeTestCase {
|
|||
.actionGet();
|
||||
|
||||
client().prepareIndex("throttled_threadpool_index", "_doc", "1").setSource("field", "value").setRefreshPolicy(IMMEDIATE).get();
|
||||
assertHitCount(client().prepareSearch().get(), 1L);
|
||||
assertHitCount(client().prepareSearch().setIndicesOptions(IndicesOptions.STRICT_EXPAND_OPEN_FORBID_CLOSED).get(), 1L);
|
||||
}
|
||||
|
||||
public void testExpandSearchFrozen() {
|
||||
createIndex("frozen_index");
|
||||
client().execute(
|
||||
InternalOrPrivateSettingsPlugin.UpdateInternalOrPrivateAction.INSTANCE,
|
||||
new InternalOrPrivateSettingsPlugin.UpdateInternalOrPrivateAction.Request("frozen_index",
|
||||
"index.frozen", "true"))
|
||||
.actionGet();
|
||||
|
||||
client().prepareIndex("frozen_index", "_doc", "1").setSource("field", "value").setRefreshPolicy(IMMEDIATE).get();
|
||||
assertHitCount(client().prepareSearch().get(), 0L);
|
||||
assertHitCount(client().prepareSearch().setIndicesOptions(IndicesOptions.STRICT_EXPAND_OPEN_FORBID_CLOSED).get(), 1L);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.elasticsearch.cluster.metadata.AliasMetadata;
|
|||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.collect.ImmutableOpenMap;
|
||||
import org.elasticsearch.index.IndexNotFoundException;
|
||||
import org.elasticsearch.index.IndexSettings;
|
||||
import org.elasticsearch.xpack.ql.QlIllegalArgumentException;
|
||||
import org.elasticsearch.xpack.ql.type.ConstantKeywordEsField;
|
||||
import org.elasticsearch.xpack.ql.type.DataType;
|
||||
|
@ -267,7 +266,7 @@ public class IndexResolver {
|
|||
if (indicesNames != null) {
|
||||
for (String indexName : indicesNames) {
|
||||
boolean isFrozen = retrieveFrozenIndices
|
||||
&& IndexSettings.INDEX_SEARCH_THROTTLED.get(indices.getSettings().get(indexName)) == Boolean.TRUE;
|
||||
&& indices.getSettings().get(indexName).getAsBoolean("index.frozen", false);
|
||||
|
||||
if (pattern == null || pattern.matcher(indexName).matches()) {
|
||||
result.add(new IndexInfo(indexName, isFrozen ? IndexType.FROZEN_INDEX : IndexType.STANDARD_INDEX));
|
||||
|
|
Loading…
Reference in New Issue