diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/resolve/ResolveIndexAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/resolve/ResolveIndexAction.java index 2bc379af0715f..53299e80f65b7 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/resolve/ResolveIndexAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/resolve/ResolveIndexAction.java @@ -766,7 +766,7 @@ static void resolveIndices( if (names.length == 1 && (Metadata.ALL.equals(names[0]) || Regex.isMatchAllPattern(names[0]))) { names = new String[] { "**" }; } - assert indicesOptions.wildcardOptions().resolveViews() == false : "Views are not supported in ResolveIndexAction"; + assert indicesOptions.indexAbstractionOptions().resolveViews() == false : "Views are not supported in ResolveIndexAction"; Set resolvedIndexAbstractions = resolver.resolveExpressions( projectState.metadata(), indicesOptions, diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/TransportRolloverAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/TransportRolloverAction.java index 6d131b7375cc6..029438ffb9ab3 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/TransportRolloverAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/TransportRolloverAction.java @@ -160,7 +160,8 @@ protected ClusterBlockException checkBlock(RolloverRequest request, ClusterState .matchClosed(request.indicesOptions().expandWildcardsClosed()) .build(), IndicesOptions.GatekeeperOptions.DEFAULT, - IndicesOptions.CrossProjectModeOptions.DEFAULT + IndicesOptions.CrossProjectModeOptions.DEFAULT, + IndicesOptions.IndexAbstractionOptions.DEFAULT ); ResolvedExpression resolvedRolloverTarget = SelectorResolver.parseExpression(request.getRolloverTarget(), request.indicesOptions()); final IndexAbstraction indexAbstraction = projectMetadata.getIndicesLookup().get(resolvedRolloverTarget.resource()); @@ -257,7 +258,8 @@ protected void masterOperation( IndicesOptions.ConcreteTargetOptions.ALLOW_UNAVAILABLE_TARGETS, IndicesOptions.WildcardOptions.builder().matchClosed(true).allowEmptyExpressions(false).build(), IndicesOptions.GatekeeperOptions.DEFAULT, - IndicesOptions.CrossProjectModeOptions.DEFAULT + IndicesOptions.CrossProjectModeOptions.DEFAULT, + IndicesOptions.IndexAbstractionOptions.DEFAULT ); // Make sure to recombine any selectors on the stats request IndicesStatsRequest statsRequest = new IndicesStatsRequest().indices(resolvedRolloverTarget.combined()) diff --git a/server/src/main/java/org/elasticsearch/action/support/IndicesOptions.java b/server/src/main/java/org/elasticsearch/action/support/IndicesOptions.java index a635ba58a0a7b..74bd989d3ffb7 100644 --- a/server/src/main/java/org/elasticsearch/action/support/IndicesOptions.java +++ b/server/src/main/java/org/elasticsearch/action/support/IndicesOptions.java @@ -48,12 +48,15 @@ * does not support certain options. * @param crossProjectModeOptions, applies to all the indices and adds logic specific for cross-project search. These options are * internal-only and can change over the lifetime of a single request. + * @param indexAbstractionOptions, controls which types of index abstractions (aliases, views, etc.) participate in index + * resolution. These options apply to both concrete and wildcard resolution paths. */ public record IndicesOptions( ConcreteTargetOptions concreteTargetOptions, WildcardOptions wildcardOptions, GatekeeperOptions gatekeeperOptions, - CrossProjectModeOptions crossProjectModeOptions + CrossProjectModeOptions crossProjectModeOptions, + IndexAbstractionOptions indexAbstractionOptions ) implements ToXContentFragment { public static IndicesOptions.Builder builder() { @@ -97,21 +100,19 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws * @param resolveAliases, aliases will be included in the result, if false we treat them like they do not exist * @param allowEmptyExpressions, when an expression does not result in any indices, if false it throws an error if true it treats it as * an empty result - * @param resolveViews, views will be included in the result, if false we treat them like they do not exist */ public record WildcardOptions( boolean matchOpen, boolean matchClosed, boolean includeHidden, boolean resolveAliases, - boolean allowEmptyExpressions, - boolean resolveViews + boolean allowEmptyExpressions ) implements ToXContentFragment { public static final String EXPAND_WILDCARDS = "expand_wildcards"; public static final String ALLOW_NO_INDICES = "allow_no_indices"; - public static final WildcardOptions DEFAULT = new WildcardOptions(true, false, false, true, true, false); + public static final WildcardOptions DEFAULT = new WildcardOptions(true, false, false, true, true); public static WildcardOptions parseParameters(Object expandWildcards, Object allowNoIndices, WildcardOptions defaultOptions) { if (expandWildcards == null && allowNoIndices == null) { @@ -180,7 +181,6 @@ public static class Builder { private boolean includeHidden; private boolean resolveAliases; private boolean allowEmptyExpressions; - private boolean resolveViews; Builder() { this(DEFAULT); @@ -192,7 +192,6 @@ public static class Builder { includeHidden = options.includeHidden; resolveAliases = options.resolveAliases; allowEmptyExpressions = options.allowEmptyExpressions; - resolveViews = options.resolveViews; } /** @@ -248,14 +247,6 @@ public Builder matchNone() { return this; } - /** - * Resolve views. Defaults to false - */ - public Builder resolveViews(boolean resolveViews) { - this.resolveViews = resolveViews; - return this; - } - /** * Maximises the resolution of indices, we will match open, closed and hidden targets. */ @@ -293,7 +284,7 @@ public Builder expandStates(String[] expandStates) { } public WildcardOptions build() { - return new WildcardOptions(matchOpen, matchClosed, includeHidden, resolveAliases, allowEmptyExpressions, resolveViews); + return new WildcardOptions(matchOpen, matchClosed, includeHidden, resolveAliases, allowEmptyExpressions); } } @@ -460,6 +451,48 @@ public static CrossProjectModeOptions readFrom(StreamInput in) throws IOExceptio } } + /** + * Controls which types of index abstractions participate in index resolution. These options apply uniformly + * to both concrete target and wildcard resolution paths. + * @param resolveViews, views will be included in the result, if false we treat them like they do not exist. Defaults to false. + */ + public record IndexAbstractionOptions(boolean resolveViews) { + + public static final IndexAbstractionOptions DEFAULT = new IndexAbstractionOptions(false); + + public static class Builder { + private boolean resolveViews; + + Builder() { + this(DEFAULT); + } + + Builder(IndexAbstractionOptions options) { + resolveViews = options.resolveViews; + } + + /** + * Views will be included in the result. Defaults to false. + */ + public Builder resolveViews(boolean resolveViews) { + this.resolveViews = resolveViews; + return this; + } + + public IndexAbstractionOptions build() { + return new IndexAbstractionOptions(resolveViews); + } + } + + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(IndexAbstractionOptions indexAbstractionOptions) { + return new Builder(indexAbstractionOptions); + } + } + /** * This class is maintained for backwards compatibility and performance purposes. We use it for serialisation along with {@link Option}. */ @@ -511,7 +544,8 @@ private enum Option { ConcreteTargetOptions.ERROR_WHEN_UNAVAILABLE_TARGETS, WildcardOptions.DEFAULT, GatekeeperOptions.DEFAULT, - CrossProjectModeOptions.DEFAULT + CrossProjectModeOptions.DEFAULT, + IndexAbstractionOptions.DEFAULT ); public static final IndicesOptions STRICT_EXPAND_OPEN = IndicesOptions.builder() @@ -997,7 +1031,8 @@ public static IndicesOptions readIndicesOptions(StreamInput in) throws IOExcepti : ConcreteTargetOptions.ERROR_WHEN_UNAVAILABLE_TARGETS, wildcardOptions, gatekeeperOptions, - CrossProjectModeOptions.readFrom(in) + CrossProjectModeOptions.readFrom(in), + IndexAbstractionOptions.DEFAULT ); } @@ -1006,6 +1041,7 @@ public static class Builder { private WildcardOptions wildcardOptions; private GatekeeperOptions gatekeeperOptions; private CrossProjectModeOptions crossProjectModeOptions; + private IndexAbstractionOptions indexAbstractionOptions; Builder() { this(DEFAULT); @@ -1016,6 +1052,7 @@ public static class Builder { wildcardOptions = indicesOptions.wildcardOptions; gatekeeperOptions = indicesOptions.gatekeeperOptions; crossProjectModeOptions = indicesOptions.crossProjectModeOptions; + indexAbstractionOptions = indicesOptions.indexAbstractionOptions; } public Builder concreteTargetOptions(ConcreteTargetOptions concreteTargetOptions) { @@ -1048,8 +1085,24 @@ public Builder crossProjectModeOptions(CrossProjectModeOptions crossProjectModeO return this; } + public Builder indexAbstractionOptions(IndexAbstractionOptions indexAbstractionOptions) { + this.indexAbstractionOptions = indexAbstractionOptions; + return this; + } + + public Builder indexAbstractionOptions(IndexAbstractionOptions.Builder indexAbstractionOptions) { + this.indexAbstractionOptions = indexAbstractionOptions.build(); + return this; + } + public IndicesOptions build() { - return new IndicesOptions(concreteTargetOptions, wildcardOptions, gatekeeperOptions, crossProjectModeOptions); + return new IndicesOptions( + concreteTargetOptions, + wildcardOptions, + gatekeeperOptions, + crossProjectModeOptions, + indexAbstractionOptions + ); } } @@ -1152,7 +1205,8 @@ public static IndicesOptions fromOptions( ignoreUnavailable ? ConcreteTargetOptions.ALLOW_UNAVAILABLE_TARGETS : ConcreteTargetOptions.ERROR_WHEN_UNAVAILABLE_TARGETS, wildcards, gatekeeperOptions, - CrossProjectModeOptions.DEFAULT + CrossProjectModeOptions.DEFAULT, + IndexAbstractionOptions.DEFAULT ); } @@ -1235,6 +1289,7 @@ public static IndicesOptions fromParameters( .wildcardOptions(wildcards) .gatekeeperOptions(gatekeeperOptions) .crossProjectModeOptions(crossProjectModeOptions) + .indexAbstractionOptions(defaultSettings.indexAbstractionOptions) .build(); } @@ -1510,6 +1565,8 @@ public String toString() { + allowSelectors() + ", include_failure_indices=" + includeFailureIndices() + + ", resolve_views=" + + indexAbstractionOptions.resolveViews() + ", resolve_cross_project_index_expression=" + resolveCrossProjectIndexExpression() + ']'; diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/IndexAbstractionResolver.java b/server/src/main/java/org/elasticsearch/cluster/metadata/IndexAbstractionResolver.java index fbf9769700a8d..6c804d4788c1d 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/IndexAbstractionResolver.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/IndexAbstractionResolver.java @@ -308,7 +308,7 @@ private static boolean isIndexVisible( throw new IllegalStateException("could not resolve index abstraction [" + index + "]"); } if (indexAbstraction.getType() == IndexAbstraction.Type.VIEW) { - return indicesOptions.wildcardOptions().resolveViews(); + return indicesOptions.indexAbstractionOptions().resolveViews(); } final boolean isHidden = indexAbstraction.isHidden(); boolean isVisible = isWildcardExpression == false diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolver.java b/server/src/main/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolver.java index 290bd1e9345bb..ea3f2ad1ba090 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolver.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolver.java @@ -1522,7 +1522,7 @@ private static boolean ensureAliasOrIndexExists(Context context, String name, In throw infe; } } - if (indexAbstraction.getType() == Type.VIEW && context.getOptions().wildcardOptions().resolveViews() == false) { + if (indexAbstraction.getType() == Type.VIEW && context.getOptions().indexAbstractionOptions().resolveViews() == false) { if (ignoreUnavailable) { return false; } else { @@ -1797,7 +1797,7 @@ private static boolean shouldExpandToIndexAbstraction( String wildcardExpression, IndexAbstraction indexAbstraction ) { - if (context.getOptions().wildcardOptions().resolveViews() == false && indexAbstraction.getType() == Type.VIEW) { + if (context.getOptions().indexAbstractionOptions().resolveViews() == false && indexAbstraction.getType() == Type.VIEW) { return false; } if (context.getOptions().ignoreAliases() && indexAbstraction.getType() == Type.ALIAS) { @@ -1852,7 +1852,7 @@ private static Set expandToOpenClosed( } else if (context.isPreserveDataStreams() && indexAbstraction.getType() == Type.DATA_STREAM) { resources.add(new ResolvedExpression(indexAbstraction.getName(), selector)); } else if (indexAbstraction.getType() == Type.VIEW) { - if (context.getOptions().wildcardOptions().resolveViews()) { + if (context.getOptions().indexAbstractionOptions().resolveViews()) { resources.add(new ResolvedExpression(indexAbstraction.getName(), selector)); } } else { diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/create/CreateSnapshotRequestTests.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/create/CreateSnapshotRequestTests.java index 0b76d4e0132f1..6d620acca63b7 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/create/CreateSnapshotRequestTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/create/CreateSnapshotRequestTests.java @@ -86,8 +86,7 @@ public void testToXContent() throws IOException { randomBoolean(), randomBoolean(), defaultResolveAliasForThisRequest, - randomBoolean(), - false // Specifying views in the create snapshot request is not supported + randomBoolean() ) ) .gatekeeperOptions(IndicesOptions.GatekeeperOptions.builder().allowSelectors(false).includeFailureIndices(true).build()) diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotRequestTests.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotRequestTests.java index 79dab71f0640e..f861afdc8ac2c 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotRequestTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotRequestTests.java @@ -87,8 +87,7 @@ private RestoreSnapshotRequest randomState(RestoreSnapshotRequest instance) { randomBoolean(), randomBoolean(), instance.indicesOptions().ignoreAliases() == false, - randomBoolean(), - false // Specifying views in the restore snapshot request is not supported + randomBoolean() ) ) .gatekeeperOptions(IndicesOptions.GatekeeperOptions.builder().allowSelectors(false).includeFailureIndices(true).build()) diff --git a/server/src/test/java/org/elasticsearch/action/support/IndicesOptionsTests.java b/server/src/test/java/org/elasticsearch/action/support/IndicesOptionsTests.java index 0cfad5682d589..fcad9821caa13 100644 --- a/server/src/test/java/org/elasticsearch/action/support/IndicesOptionsTests.java +++ b/server/src/test/java/org/elasticsearch/action/support/IndicesOptionsTests.java @@ -12,6 +12,7 @@ import org.elasticsearch.action.support.IndicesOptions.ConcreteTargetOptions; import org.elasticsearch.action.support.IndicesOptions.CrossProjectModeOptions; import org.elasticsearch.action.support.IndicesOptions.GatekeeperOptions; +import org.elasticsearch.action.support.IndicesOptions.IndexAbstractionOptions; import org.elasticsearch.action.support.IndicesOptions.WildcardOptions; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.io.stream.BytesStreamOutput; @@ -59,6 +60,7 @@ public void testSerialization() throws Exception { .allowSelectors(randomBoolean()) ) .crossProjectModeOptions(new CrossProjectModeOptions(randomBoolean())) + .indexAbstractionOptions(IndexAbstractionOptions.builder().resolveViews(randomBoolean())) .build(); BytesStreamOutput output = new BytesStreamOutput(); @@ -67,7 +69,10 @@ public void testSerialization() throws Exception { StreamInput streamInput = output.bytes().streamInput(); IndicesOptions indicesOptions2 = IndicesOptions.readIndicesOptions(streamInput); - assertThat(indicesOptions2, equalTo(indicesOptions)); + IndicesOptions expected = IndicesOptions.builder(indicesOptions) + .indexAbstractionOptions(IndexAbstractionOptions.builder(indicesOptions.indexAbstractionOptions()).resolveViews(false)) + .build(); + assertThat(indicesOptions2, equalTo(expected)); } } @@ -345,7 +350,6 @@ public void testToXContent() throws IOException { randomBoolean(), randomBoolean(), randomBoolean(), - randomBoolean(), randomBoolean() ); GatekeeperOptions gatekeeperOptions = new GatekeeperOptions( @@ -356,12 +360,14 @@ public void testToXContent() throws IOException { randomBoolean() ); CrossProjectModeOptions crossProjectModeOptions = new CrossProjectModeOptions(randomBoolean()); + IndexAbstractionOptions indexAbstractionOptions = new IndexAbstractionOptions(randomBoolean()); IndicesOptions indicesOptions = new IndicesOptions( concreteTargetOptions, wildcardOptions, gatekeeperOptions, - crossProjectModeOptions + crossProjectModeOptions, + indexAbstractionOptions ); XContentType type = randomFrom(XContentType.values()); @@ -385,7 +391,6 @@ public void testFromXContent() throws IOException { randomBoolean(), randomBoolean(), randomBoolean(), - randomBoolean(), randomBoolean() ); ConcreteTargetOptions concreteTargetOptions = new ConcreteTargetOptions(randomBoolean()); diff --git a/server/src/test/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolverTests.java b/server/src/test/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolverTests.java index 1a599683c8052..64bd079f92583 100644 --- a/server/src/test/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolverTests.java +++ b/server/src/test/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolverTests.java @@ -2414,7 +2414,8 @@ public void testIgnoreThrottled() { IndicesOptions.ConcreteTargetOptions.ERROR_WHEN_UNAVAILABLE_TARGETS, IndicesOptions.WildcardOptions.DEFAULT, IndicesOptions.GatekeeperOptions.builder().ignoreThrottled(true).build(), - IndicesOptions.CrossProjectModeOptions.DEFAULT + IndicesOptions.CrossProjectModeOptions.DEFAULT, + IndicesOptions.IndexAbstractionOptions.DEFAULT ), "ind*", "test-index" diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlResolveViewAction.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlResolveViewAction.java index 93b21ef167044..d23b5335cb11f 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlResolveViewAction.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlResolveViewAction.java @@ -80,7 +80,8 @@ public static class Request extends LocalClusterStateRequest implements IndicesR private String[] indices = new String[0]; private ResolvedIndexExpressions resolvedIndexExpressions; private static final IndicesOptions VIEW_INDICES_OPTIONS = IndicesOptions.builder() - .wildcardOptions(IndicesOptions.WildcardOptions.builder().resolveViews(true).allowEmptyExpressions(true)) + .wildcardOptions(IndicesOptions.WildcardOptions.builder().allowEmptyExpressions(true)) + .indexAbstractionOptions(IndicesOptions.IndexAbstractionOptions.builder().resolveViews(true).build()) .concreteTargetOptions(IndicesOptions.ConcreteTargetOptions.ALLOW_UNAVAILABLE_TARGETS) .build(); diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/view/DeleteViewAction.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/view/DeleteViewAction.java index fa2487909349e..e24a68ed8fb30 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/view/DeleteViewAction.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/view/DeleteViewAction.java @@ -30,7 +30,7 @@ public class DeleteViewAction extends ActionType { public static final IndicesOptions DEFAULT_INDICES_OPTIONS = IndicesOptions.builder() .concreteTargetOptions(IndicesOptions.ConcreteTargetOptions.ERROR_WHEN_UNAVAILABLE_TARGETS) - .wildcardOptions(IndicesOptions.WildcardOptions.builder().resolveViews(true).build()) + .indexAbstractionOptions(IndicesOptions.IndexAbstractionOptions.builder().resolveViews(true).build()) .build(); private DeleteViewAction() { diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/view/GetViewAction.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/view/GetViewAction.java index d0d46d142dbdc..bce5e5be7aa04 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/view/GetViewAction.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/view/GetViewAction.java @@ -38,7 +38,7 @@ public class GetViewAction extends ActionType { public static final String NAME = EsqlViewActionNames.ESQL_GET_VIEW_ACTION_NAME; private static final IndicesOptions VIEW_INDICES_OPTIONS = IndicesOptions.builder() - .wildcardOptions(IndicesOptions.WildcardOptions.builder().resolveViews(true)) + .indexAbstractionOptions(IndicesOptions.IndexAbstractionOptions.builder().resolveViews(true).build()) .concreteTargetOptions(ERROR_WHEN_UNAVAILABLE_TARGETS) .build(); diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/view/PutViewAction.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/view/PutViewAction.java index e501c482bdd2d..cc7113d2e25c7 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/view/PutViewAction.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/view/PutViewAction.java @@ -33,7 +33,7 @@ public class PutViewAction extends ActionType { public static final IndicesOptions DEFAULT_INDICES_OPTIONS = IndicesOptions.builder() .concreteTargetOptions(IndicesOptions.ConcreteTargetOptions.ERROR_WHEN_UNAVAILABLE_TARGETS) - .wildcardOptions(IndicesOptions.WildcardOptions.builder().resolveViews(true).build()) + .indexAbstractionOptions(IndicesOptions.IndexAbstractionOptions.builder().resolveViews(true).build()) .build(); private PutViewAction() { diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/view/ViewResolutionServiceTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/view/ViewResolutionServiceTests.java index 50ab8d5cfc29e..89d5c5d083bff 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/view/ViewResolutionServiceTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/view/ViewResolutionServiceTests.java @@ -33,7 +33,7 @@ public void testResolveMissing() { clusterState.projectState(ProjectId.DEFAULT), new String[] { "missing" }, IndicesOptions.builder() - .wildcardOptions(IndicesOptions.WildcardOptions.builder().resolveViews(true)) + .indexAbstractionOptions(IndicesOptions.IndexAbstractionOptions.builder().resolveViews(true).build()) .concreteTargetOptions(ERROR_WHEN_UNAVAILABLE_TARGETS) .build(), null diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/DatafeedNodeSelectorTests.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/DatafeedNodeSelectorTests.java index bf5287ecd480a..be8ef29c8a3aa 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/DatafeedNodeSelectorTests.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/datafeed/DatafeedNodeSelectorTests.java @@ -349,8 +349,8 @@ public void testIndexDoesntExist() { + "indices_options [IndicesOptions[ignore_unavailable=false, allow_no_indices=true, expand_wildcards_open=true, " + "expand_wildcards_closed=false, expand_wildcards_hidden=false, allow_aliases_to_multiple_indices=true, " + "forbid_closed_indices=true, ignore_aliases=false, ignore_throttled=true, " - + "allow_selectors=true, include_failure_indices=false, resolve_cross_project_index_expression=false]] " - + "with exception [no such index [not_foo]]" + + "allow_selectors=true, include_failure_indices=false, resolve_views=false, " + + "resolve_cross_project_index_expression=false]] with exception [no such index [not_foo]]" ) ) ); @@ -385,7 +385,7 @@ public void testIndexDoesntExist() { + "expand_wildcards_open=true, expand_wildcards_closed=false, expand_wildcards_hidden=false, " + "allow_aliases_to_multiple_indices=true, forbid_closed_indices=true, ignore_aliases=false, " + "ignore_throttled=true, allow_selectors=true, include_failure_indices=false," - + " resolve_cross_project_index_expression=false]] with exception [no such index [not_foo]]]" + + " resolve_views=false, resolve_cross_project_index_expression=false]] with exception [no such index [not_foo]]]" ) ) ); @@ -562,8 +562,8 @@ public void testSelectNode_GivenJobOpeningAndIndexDoesNotExist() { + "indices_options [IndicesOptions[ignore_unavailable=false, allow_no_indices=true, expand_wildcards_open=true, " + "expand_wildcards_closed=false, expand_wildcards_hidden=false, allow_aliases_to_multiple_indices=true, " + "forbid_closed_indices=true, ignore_aliases=false, ignore_throttled=true, " - + "allow_selectors=true, include_failure_indices=false, resolve_cross_project_index_expression=false]]" - + " with exception [no such index [not_foo]]]" + + "allow_selectors=true, include_failure_indices=false, resolve_views=false, " + + "resolve_cross_project_index_expression=false]] with exception [no such index [not_foo]]]" ) ) ); diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/IndicesAndAliasesResolver.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/IndicesAndAliasesResolver.java index 65f34e7a1bb4b..65c5d5d9cb691 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/IndicesAndAliasesResolver.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/IndicesAndAliasesResolver.java @@ -580,7 +580,7 @@ private boolean shouldSetResolvedIndexExpressions(IndicesRequest.Replaceable rep // Only store resolved expressions if cross-project mode or if views should be resolved, to avoid unnecessary memory usage. Once // we've migrated from `indices()` to using resolved expressions holistically, we will always store them if (crossProjectModeDecider.crossProjectEnabled() == false - && replaceable.indicesOptions().wildcardOptions().resolveViews() == false) { + && replaceable.indicesOptions().indexAbstractionOptions().resolveViews() == false) { return false; }