diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/ClusterStateLicenseService.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/ClusterStateLicenseService.java index a38170d87f9a..873a5b4587e0 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/ClusterStateLicenseService.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/ClusterStateLicenseService.java @@ -28,7 +28,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.core.Nullable; import org.elasticsearch.core.SuppressForbidden; import org.elasticsearch.core.TimeValue; -import org.elasticsearch.features.FeatureService; import org.elasticsearch.gateway.GatewayService; import org.elasticsearch.license.internal.MutableLicenseService; import org.elasticsearch.license.internal.TrialLicenseVersion; @@ -65,7 +64,6 @@ public class ClusterStateLicenseService extends AbstractLifecycleComponent private final Settings settings; private final ClusterService clusterService; - private final FeatureService featureService; /** * The xpack feature state to update when license changes are made. @@ -104,12 +102,10 @@ public class ClusterStateLicenseService extends AbstractLifecycleComponent ThreadPool threadPool, ClusterService clusterService, Clock clock, - XPackLicenseState xPacklicenseState, - FeatureService featureService + XPackLicenseState xPacklicenseState ) { this.settings = settings; this.clusterService = clusterService; - this.featureService = featureService; this.startTrialTaskQueue = clusterService.createTaskQueue( "license-service-start-trial", Priority.NORMAL, @@ -344,7 +340,7 @@ public class ClusterStateLicenseService extends AbstractLifecycleComponent } startTrialTaskQueue.submitTask( StartTrialClusterTask.TASK_SOURCE, - new StartTrialClusterTask(logger, clusterService.getClusterName().value(), clock, featureService, request, listener), + new StartTrialClusterTask(logger, clusterService.getClusterName().value(), clock, request, listener), null // TODO should pass in request.masterNodeTimeout() here ); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/License.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/License.java index 1d6f53c9aa23..d3347f3432a4 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/License.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/License.java @@ -16,7 +16,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.core.UpdateForV9; -import org.elasticsearch.features.NodeFeature; import org.elasticsearch.xcontent.ToXContentObject; import org.elasticsearch.xcontent.XContentBuilder; import org.elasticsearch.xcontent.XContentParser; @@ -39,8 +38,6 @@ import java.util.stream.Stream; */ public class License implements ToXContentObject { - public static final NodeFeature INDEPENDENT_TRIAL_VERSION_FEATURE = new NodeFeature("license-trial-independent-version", true); - public enum LicenseType { BASIC, STANDARD, diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/StartTrialClusterTask.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/StartTrialClusterTask.java index 22f4de105cb2..bec2ee98b175 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/StartTrialClusterTask.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/StartTrialClusterTask.java @@ -13,7 +13,6 @@ import org.elasticsearch.cluster.ClusterStateTaskExecutor; import org.elasticsearch.cluster.ClusterStateTaskListener; import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.core.Nullable; -import org.elasticsearch.features.FeatureService; import org.elasticsearch.license.internal.TrialLicenseVersion; import org.elasticsearch.xpack.core.XPackPlugin; @@ -41,13 +40,11 @@ public class StartTrialClusterTask implements ClusterStateTaskListener { private final PostStartTrialRequest request; private final ActionListener listener; private final Clock clock; - private final FeatureService featureService; StartTrialClusterTask( Logger logger, String clusterName, Clock clock, - FeatureService featureService, PostStartTrialRequest request, ActionListener listener ) { @@ -56,7 +53,6 @@ public class StartTrialClusterTask implements ClusterStateTaskListener { this.request = request; this.listener = listener; this.clock = clock; - this.featureService = featureService; } private LicensesMetadata execute( @@ -65,9 +61,6 @@ public class StartTrialClusterTask implements ClusterStateTaskListener { ClusterStateTaskExecutor.TaskContext taskContext ) { assert taskContext.getTask() == this; - if (featureService.clusterHasFeature(state, License.INDEPENDENT_TRIAL_VERSION_FEATURE) == false) { - throw new IllegalStateException("Please ensure all nodes are up to date before starting your trial"); - } final var listener = ActionListener.runBefore(this.listener, () -> { logger.debug("started self generated trial license: {}", currentLicensesMetadata); }); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackFeatures.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackFeatures.java index 42f66c6ca6ee..42824a553d2b 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackFeatures.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackFeatures.java @@ -9,8 +9,6 @@ package org.elasticsearch.xpack.core; import org.elasticsearch.features.FeatureSpecification; import org.elasticsearch.features.NodeFeature; -import org.elasticsearch.license.License; -import org.elasticsearch.xpack.core.datatiers.NodesDataTiersUsageTransportAction; import java.util.Set; @@ -18,16 +16,8 @@ import java.util.Set; * Provides the XPack features that this version of the code supports */ public class XPackFeatures implements FeatureSpecification { - public static final NodeFeature LOGSDB_TELEMETRY = new NodeFeature("logsdb_telemetry", true); - public static final NodeFeature LOGSDB_TELMETRY_STATS = new NodeFeature("logsdb_telemetry_stats", true); - @Override public Set getFeatures() { - return Set.of( - NodesDataTiersUsageTransportAction.LOCALLY_PRECALCULATED_STATS_FEATURE, // Added in 8.12 - License.INDEPENDENT_TRIAL_VERSION_FEATURE, // 8.14.0 - LOGSDB_TELEMETRY, - LOGSDB_TELMETRY_STATS - ); + return Set.of(); } } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackPlugin.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackPlugin.java index f79a3fbf124b..cf5ebc8adc56 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackPlugin.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackPlugin.java @@ -331,8 +331,7 @@ public class XPackPlugin extends XPackClientPlugin services.threadPool(), services.clusterService(), getClock(), - getLicenseState(), - services.featureService() + getLicenseState() ); setLicenseService(licenseService); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/datatiers/DataTiersUsageTransportAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/datatiers/DataTiersUsageTransportAction.java index 9f265f86fae2..e859d8103666 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/datatiers/DataTiersUsageTransportAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/datatiers/DataTiersUsageTransportAction.java @@ -9,7 +9,6 @@ package org.elasticsearch.xpack.core.datatiers; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.cluster.node.stats.NodeStats; -import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.client.internal.Client; import org.elasticsearch.client.internal.ParentTaskAssigningClient; @@ -22,7 +21,6 @@ import org.elasticsearch.cluster.routing.RoutingNode; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.allocation.DataTier; import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.features.FeatureService; import org.elasticsearch.indices.NodeIndicesStats; import org.elasticsearch.injection.guice.Inject; import org.elasticsearch.protocol.xpack.XPackUsageRequest; @@ -46,7 +44,6 @@ import java.util.stream.StreamSupport; public class DataTiersUsageTransportAction extends XPackUsageFeatureTransportAction { private final Client client; - private final FeatureService featureService; @Inject public DataTiersUsageTransportAction( @@ -55,8 +52,7 @@ public class DataTiersUsageTransportAction extends XPackUsageFeatureTransportAct ThreadPool threadPool, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, - Client client, - FeatureService featureService + Client client ) { super( XPackUsageFeatureAction.DATA_TIERS.name(), @@ -67,7 +63,6 @@ public class DataTiersUsageTransportAction extends XPackUsageFeatureTransportAct indexNameExpressionResolver ); this.client = client; - this.featureService = featureService; } @Override @@ -77,42 +72,22 @@ public class DataTiersUsageTransportAction extends XPackUsageFeatureTransportAct ClusterState state, ActionListener listener ) { - if (featureService.clusterHasFeature(state, NodesDataTiersUsageTransportAction.LOCALLY_PRECALCULATED_STATS_FEATURE)) { - new ParentTaskAssigningClient(client, clusterService.localNode(), task).admin() - .cluster() - .execute( - NodesDataTiersUsageTransportAction.TYPE, - new NodesDataTiersUsageTransportAction.NodesRequest(), - listener.delegateFailureAndWrap((delegate, response) -> { - // Generate tier specific stats for the nodes and indices - delegate.onResponse( - new XPackUsageFeatureResponse( - new DataTiersFeatureSetUsage( - aggregateStats(response.getNodes(), getIndicesGroupedByTier(state, response.getNodes())) - ) - ) - ); - }) - ); - } else { - new ParentTaskAssigningClient(client, clusterService.localNode(), task).admin() - .cluster() - .prepareNodesStats() - .setIndices(new CommonStatsFlags(CommonStatsFlags.Flag.Docs, CommonStatsFlags.Flag.Store)) - .execute(listener.delegateFailureAndWrap((delegate, nodesStatsResponse) -> { - List response = nodesStatsResponse.getNodes() - .stream() - .map( - nodeStats -> new NodeDataTiersUsage(nodeStats.getNode(), precalculateLocalStatsFromNodeStats(nodeStats, state)) - ) - .toList(); + new ParentTaskAssigningClient(client, clusterService.localNode(), task).admin() + .cluster() + .execute( + NodesDataTiersUsageTransportAction.TYPE, + new NodesDataTiersUsageTransportAction.NodesRequest(), + listener.delegateFailureAndWrap((delegate, response) -> { + // Generate tier specific stats for the nodes and indices delegate.onResponse( new XPackUsageFeatureResponse( - new DataTiersFeatureSetUsage(aggregateStats(response, getIndicesGroupedByTier(state, response))) + new DataTiersFeatureSetUsage( + aggregateStats(response.getNodes(), getIndicesGroupedByTier(state, response.getNodes())) + ) ) ); - })); - } + }) + ); } // Visible for testing diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/datatiers/NodesDataTiersUsageTransportAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/datatiers/NodesDataTiersUsageTransportAction.java index 39cbb9788327..99bb926b0a3c 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/datatiers/NodesDataTiersUsageTransportAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/datatiers/NodesDataTiersUsageTransportAction.java @@ -26,7 +26,6 @@ import org.elasticsearch.cluster.routing.ShardRoutingState; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.features.NodeFeature; import org.elasticsearch.index.shard.DocsStats; import org.elasticsearch.index.store.StoreStats; import org.elasticsearch.indices.IndicesService; @@ -58,7 +57,6 @@ public class NodesDataTiersUsageTransportAction extends TransportNodesAction< Void> { public static final ActionType TYPE = new ActionType<>("cluster:monitor/nodes/data_tier_usage"); - public static final NodeFeature LOCALLY_PRECALCULATED_STATS_FEATURE = new NodeFeature("usage.data_tiers.precalculate_stats", true); private static final CommonStatsFlags STATS_FLAGS = new CommonStatsFlags().clear() .set(CommonStatsFlags.Flag.Docs, true) diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/license/AbstractClusterStateLicenseServiceTestCase.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/license/AbstractClusterStateLicenseServiceTestCase.java index a3a12792df4a..a85656d8e32b 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/license/AbstractClusterStateLicenseServiceTestCase.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/license/AbstractClusterStateLicenseServiceTestCase.java @@ -18,7 +18,6 @@ import org.elasticsearch.common.collect.Iterators; import org.elasticsearch.common.component.Lifecycle; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; -import org.elasticsearch.features.FeatureService; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.threadpool.TestThreadPool; import org.elasticsearch.threadpool.ThreadPool; @@ -27,7 +26,6 @@ import org.elasticsearch.xpack.core.watcher.watch.ClockMock; import org.junit.After; import org.junit.Before; -import java.util.List; import java.util.stream.Stream; import static java.util.Collections.emptySet; @@ -66,14 +64,7 @@ public abstract class AbstractClusterStateLicenseServiceTestCase extends ESTestC protected void setInitialState(License license, XPackLicenseState licenseState, Settings settings, String selfGeneratedType) { licenseType = selfGeneratedType; settings = Settings.builder().put(settings).put(LicenseSettings.SELF_GENERATED_LICENSE_TYPE.getKey(), licenseType).build(); - licenseService = new ClusterStateLicenseService( - settings, - threadPool, - clusterService, - clock, - licenseState, - new FeatureService(List.of()) - ); + licenseService = new ClusterStateLicenseService(settings, threadPool, clusterService, clock, licenseState); ClusterState state = mock(ClusterState.class); final ClusterBlocks noBlock = ClusterBlocks.builder().build(); when(state.blocks()).thenReturn(noBlock); diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/license/ClusterStateLicenseServiceTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/license/ClusterStateLicenseServiceTests.java index aaadecef6021..61530d1bd77c 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/license/ClusterStateLicenseServiceTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/license/ClusterStateLicenseServiceTests.java @@ -19,7 +19,6 @@ import org.elasticsearch.cluster.service.MasterServiceTaskQueue; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.core.TimeValue; -import org.elasticsearch.features.FeatureService; import org.elasticsearch.license.licensor.LicenseSigner; import org.elasticsearch.protocol.xpack.license.LicensesStatus; import org.elasticsearch.protocol.xpack.license.PutLicenseResponse; @@ -91,8 +90,7 @@ public class ClusterStateLicenseServiceTests extends ESTestCase { mock(ThreadPool.class), mockDefaultClusterService(), mock(Clock.class), - mock(XPackLicenseState.class), - new FeatureService(List.of()) + mock(XPackLicenseState.class) ); final String message = service.buildExpirationMessage(time, expired).toString(); if (expired) { @@ -187,8 +185,7 @@ public class ClusterStateLicenseServiceTests extends ESTestCase { mock(ThreadPool.class), clusterService, clock, - mock(XPackLicenseState.class), - new FeatureService(List.of()) + mock(XPackLicenseState.class) ); verify(clusterService).createTaskQueue(eq("license-service-start-basic"), any(), taskExecutorCaptor.capture()); @@ -280,8 +277,7 @@ public class ClusterStateLicenseServiceTests extends ESTestCase { threadPool, clusterService, clock, - licenseState, - new FeatureService(List.of()) + licenseState ); final PutLicenseRequest request = new PutLicenseRequest(TEST_REQUEST_TIMEOUT, TEST_REQUEST_TIMEOUT); diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/license/LicenseScheduleTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/license/LicenseScheduleTests.java index d7b308bc51f4..78bd500b55e2 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/license/LicenseScheduleTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/license/LicenseScheduleTests.java @@ -10,7 +10,6 @@ import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.scheduler.SchedulerEngine; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.core.TimeValue; -import org.elasticsearch.features.FeatureService; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.threadpool.ThreadPool; import org.junit.Before; @@ -18,7 +17,6 @@ import org.junit.Before; import java.time.Clock; import java.time.Instant; import java.time.format.DateTimeFormatter; -import java.util.List; import java.util.Locale; import static org.hamcrest.Matchers.equalTo; @@ -37,8 +35,7 @@ public class LicenseScheduleTests extends ESTestCase { mock(ThreadPool.class), mock(ClusterService.class), mock(Clock.class), - mock(XPackLicenseState.class), - new FeatureService(List.of()) + mock(XPackLicenseState.class) ); schedule = service.nextLicenseCheck(license); } diff --git a/x-pack/plugin/ent-search/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/entsearch/rules/20_query_ruleset_list.yml b/x-pack/plugin/ent-search/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/entsearch/rules/20_query_ruleset_list.yml index 0b98182b3960..f29deb943d95 100644 --- a/x-pack/plugin/ent-search/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/entsearch/rules/20_query_ruleset_list.yml +++ b/x-pack/plugin/ent-search/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/entsearch/rules/20_query_ruleset_list.yml @@ -306,10 +306,6 @@ teardown: --- 'List query rulesets - include rule types': - - requires: - cluster_features: [ "query_rule_list_types" ] - reason: 'List responses updated in 8.15.5 and 8.16.1' - - do: query_rules.put_ruleset: ruleset_id: a-test-query-ruleset-with-lots-of-criteria @@ -389,4 +385,4 @@ teardown: suffix: 1 always: 1 - match: { results.0.rule_type_counts: { pinned: 4, exclude: 1 } } - + diff --git a/x-pack/plugin/ent-search/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/entsearch/rules/70_query_rule_test.yml b/x-pack/plugin/ent-search/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/entsearch/rules/70_query_rule_test.yml index 016d9f10fe77..433a0f6705c7 100644 --- a/x-pack/plugin/ent-search/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/entsearch/rules/70_query_rule_test.yml +++ b/x-pack/plugin/ent-search/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/entsearch/rules/70_query_rule_test.yml @@ -1,8 +1,4 @@ setup: - - requires: - cluster_features: [ "query_rules.test" ] - reason: Introduced in 8.16.0 - - do: query_rules.put_ruleset: ruleset_id: test-ruleset diff --git a/x-pack/plugin/ent-search/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/entsearch/rules/80_query_rules_retriever.yml b/x-pack/plugin/ent-search/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/entsearch/rules/80_query_rules_retriever.yml index 7967516c6ad5..089a078c6220 100644 --- a/x-pack/plugin/ent-search/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/entsearch/rules/80_query_rules_retriever.yml +++ b/x-pack/plugin/ent-search/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/entsearch/rules/80_query_rules_retriever.yml @@ -1,8 +1,4 @@ setup: - - requires: - cluster_features: 'query_rule_retriever_supported' - reason: 'test requires query rule retriever implementation' - - do: indices.create: index: test-index1 diff --git a/x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/EnterpriseSearchFeatures.java b/x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/EnterpriseSearchFeatures.java index ba121f2cf865..0f5c38e6f75e 100644 --- a/x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/EnterpriseSearchFeatures.java +++ b/x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/EnterpriseSearchFeatures.java @@ -9,21 +9,13 @@ package org.elasticsearch.xpack.application; import org.elasticsearch.features.FeatureSpecification; import org.elasticsearch.features.NodeFeature; -import org.elasticsearch.xpack.application.rules.action.ListQueryRulesetsAction; -import org.elasticsearch.xpack.application.rules.retriever.QueryRuleRetrieverBuilder; import java.util.Set; -import static org.elasticsearch.xpack.application.rules.action.TestQueryRulesetAction.QUERY_RULES_TEST_API; - public class EnterpriseSearchFeatures implements FeatureSpecification { @Override public Set getFeatures() { - return Set.of( - QUERY_RULES_TEST_API, - QueryRuleRetrieverBuilder.QUERY_RULE_RETRIEVERS_SUPPORTED, - ListQueryRulesetsAction.QUERY_RULE_LIST_TYPES - ); + return Set.of(); } } diff --git a/x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/rules/action/ListQueryRulesetsAction.java b/x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/rules/action/ListQueryRulesetsAction.java index c85416c5f08c..11397583ce5b 100644 --- a/x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/rules/action/ListQueryRulesetsAction.java +++ b/x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/rules/action/ListQueryRulesetsAction.java @@ -13,7 +13,6 @@ import org.elasticsearch.action.ActionResponse; import org.elasticsearch.action.ActionType; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.features.NodeFeature; import org.elasticsearch.xcontent.ConstructingObjectParser; import org.elasticsearch.xcontent.ParseField; import org.elasticsearch.xcontent.ToXContentObject; @@ -34,8 +33,6 @@ public class ListQueryRulesetsAction { public static final String NAME = "cluster:admin/xpack/query_rules/list"; public static final ActionType INSTANCE = new ActionType<>(NAME); - public static final NodeFeature QUERY_RULE_LIST_TYPES = new NodeFeature("query_rule_list_types", true); - private ListQueryRulesetsAction() {/* no instances */} public static class Request extends ActionRequest implements ToXContentObject { diff --git a/x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/rules/action/TestQueryRulesetAction.java b/x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/rules/action/TestQueryRulesetAction.java index b8293ca64cf0..c661bc9467e6 100644 --- a/x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/rules/action/TestQueryRulesetAction.java +++ b/x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/rules/action/TestQueryRulesetAction.java @@ -16,7 +16,6 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.common.Strings; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.features.NodeFeature; import org.elasticsearch.xcontent.ConstructingObjectParser; import org.elasticsearch.xcontent.ParseField; import org.elasticsearch.xcontent.ToXContentObject; @@ -35,8 +34,6 @@ import static org.elasticsearch.xcontent.ConstructingObjectParser.optionalConstr public class TestQueryRulesetAction { - public static final NodeFeature QUERY_RULES_TEST_API = new NodeFeature("query_rules.test", true); - // TODO - We'd like to transition this to require less stringent permissions public static final ActionType TYPE = new ActionType<>("cluster:admin/xpack/query_rules/test"); diff --git a/x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/rules/retriever/QueryRuleRetrieverBuilder.java b/x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/rules/retriever/QueryRuleRetrieverBuilder.java index d63166b01b4d..528204f4132e 100644 --- a/x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/rules/retriever/QueryRuleRetrieverBuilder.java +++ b/x-pack/plugin/ent-search/src/main/java/org/elasticsearch/xpack/application/rules/retriever/QueryRuleRetrieverBuilder.java @@ -9,7 +9,6 @@ package org.elasticsearch.xpack.application.rules.retriever; import org.apache.lucene.search.ScoreDoc; import org.elasticsearch.common.ParsingException; -import org.elasticsearch.features.NodeFeature; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.RankDocsQueryBuilder; import org.elasticsearch.license.LicenseUtils; @@ -45,7 +44,6 @@ import static org.elasticsearch.xcontent.ConstructingObjectParser.optionalConstr public final class QueryRuleRetrieverBuilder extends CompoundRetrieverBuilder { public static final String NAME = "rule"; - public static final NodeFeature QUERY_RULE_RETRIEVERS_SUPPORTED = new NodeFeature("query_rule_retriever_supported", true); public static final ParseField RULESET_IDS_FIELD = new ParseField("ruleset_ids"); public static final ParseField MATCH_CRITERIA_FIELD = new ParseField("match_criteria"); @@ -76,9 +74,6 @@ public final class QueryRuleRetrieverBuilder extends CompoundRetrieverBuilder nf == QueryRuleRetrieverBuilder.QUERY_RULE_RETRIEVERS_SUPPORTED) + new RetrieverParserContext(new SearchUsage(), Predicates.never()) ); } diff --git a/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/InferenceFeatures.java b/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/InferenceFeatures.java index 580e5dd4bf8a..7d6069572ba2 100644 --- a/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/InferenceFeatures.java +++ b/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/InferenceFeatures.java @@ -11,8 +11,6 @@ import org.elasticsearch.features.FeatureSpecification; import org.elasticsearch.features.NodeFeature; import org.elasticsearch.xpack.inference.mapper.SemanticInferenceMetadataFieldsMapper; import org.elasticsearch.xpack.inference.mapper.SemanticTextFieldMapper; -import org.elasticsearch.xpack.inference.queries.SemanticQueryBuilder; -import org.elasticsearch.xpack.inference.rank.random.RandomRankRetrieverBuilder; import org.elasticsearch.xpack.inference.rank.textsimilarity.TextSimilarityRankRetrieverBuilder; import java.util.Set; @@ -26,18 +24,6 @@ import static org.elasticsearch.xpack.inference.queries.SemanticSparseVectorQuer */ public class InferenceFeatures implements FeatureSpecification { - @Override - public Set getFeatures() { - return Set.of( - TextSimilarityRankRetrieverBuilder.TEXT_SIMILARITY_RERANKER_RETRIEVER_SUPPORTED, - RandomRankRetrieverBuilder.RANDOM_RERANKER_RETRIEVER_SUPPORTED, - SemanticTextFieldMapper.SEMANTIC_TEXT_SEARCH_INFERENCE_ID, - SemanticQueryBuilder.SEMANTIC_TEXT_INNER_HITS, - SemanticTextFieldMapper.SEMANTIC_TEXT_DEFAULT_ELSER_2, - TextSimilarityRankRetrieverBuilder.TEXT_SIMILARITY_RERANKER_COMPOSITION_SUPPORTED - ); - } - private static final NodeFeature SEMANTIC_TEXT_HIGHLIGHTER = new NodeFeature("semantic_text.highlighter"); @Override diff --git a/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/mapper/SemanticTextFieldMapper.java b/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/mapper/SemanticTextFieldMapper.java index 0d2cae9335b7..115d0d7947de 100644 --- a/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/mapper/SemanticTextFieldMapper.java +++ b/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/mapper/SemanticTextFieldMapper.java @@ -104,8 +104,6 @@ import static org.elasticsearch.xpack.inference.services.elasticsearch.Elasticse * A {@link FieldMapper} for semantic text fields. */ public class SemanticTextFieldMapper extends FieldMapper implements InferenceFieldMapper { - public static final NodeFeature SEMANTIC_TEXT_SEARCH_INFERENCE_ID = new NodeFeature("semantic_text.search_inference_id", true); - public static final NodeFeature SEMANTIC_TEXT_DEFAULT_ELSER_2 = new NodeFeature("semantic_text.default_elser_2", true); public static final NodeFeature SEMANTIC_TEXT_IN_OBJECT_FIELD_FIX = new NodeFeature("semantic_text.in_object_field_fix"); public static final NodeFeature SEMANTIC_TEXT_SINGLE_FIELD_UPDATE_FIX = new NodeFeature("semantic_text.single_field_update_fix"); public static final NodeFeature SEMANTIC_TEXT_DELETE_FIX = new NodeFeature("semantic_text.delete_fix"); diff --git a/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/queries/SemanticQueryBuilder.java b/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/queries/SemanticQueryBuilder.java index dbf41cc8b25e..285739fe0936 100644 --- a/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/queries/SemanticQueryBuilder.java +++ b/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/queries/SemanticQueryBuilder.java @@ -16,7 +16,6 @@ import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.metadata.InferenceFieldMetadata; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.features.NodeFeature; import org.elasticsearch.index.mapper.MappedFieldType; import org.elasticsearch.index.query.AbstractQueryBuilder; import org.elasticsearch.index.query.MatchNoneQueryBuilder; @@ -51,9 +50,6 @@ import static org.elasticsearch.xpack.core.ClientHelper.ML_ORIGIN; import static org.elasticsearch.xpack.core.ClientHelper.executeAsyncWithOrigin; public class SemanticQueryBuilder extends AbstractQueryBuilder { - // **** THE semantic_text.inner_hits CLUSTER FEATURE IS DEFUNCT, NEVER USE IT **** - public static final NodeFeature SEMANTIC_TEXT_INNER_HITS = new NodeFeature("semantic_text.inner_hits", true); - public static final String NAME = "semantic"; private static final ParseField FIELD_FIELD = new ParseField("field"); diff --git a/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/rank/random/RandomRankRetrieverBuilder.java b/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/rank/random/RandomRankRetrieverBuilder.java index 503000c31f7e..bdc833f0c3f4 100644 --- a/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/rank/random/RandomRankRetrieverBuilder.java +++ b/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/rank/random/RandomRankRetrieverBuilder.java @@ -8,7 +8,6 @@ package org.elasticsearch.xpack.inference.rank.random; import org.elasticsearch.common.ParsingException; -import org.elasticsearch.features.NodeFeature; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.retriever.RetrieverBuilder; @@ -31,8 +30,6 @@ import static org.elasticsearch.xcontent.ConstructingObjectParser.optionalConstr */ public class RandomRankRetrieverBuilder extends RetrieverBuilder { - public static final NodeFeature RANDOM_RERANKER_RETRIEVER_SUPPORTED = new NodeFeature("random_reranker_retriever_supported", true); - public static final ParseField RETRIEVER_FIELD = new ParseField("retriever"); public static final ParseField FIELD_FIELD = new ParseField("field"); public static final ParseField RANK_WINDOW_SIZE_FIELD = new ParseField("rank_window_size"); @@ -63,9 +60,6 @@ public class RandomRankRetrieverBuilder extends RetrieverBuilder { } public static RandomRankRetrieverBuilder fromXContent(XContentParser parser, RetrieverParserContext context) throws IOException { - if (context.clusterSupportsFeature(RANDOM_RERANKER_RETRIEVER_SUPPORTED) == false) { - throw new ParsingException(parser.getTokenLocation(), "unknown retriever [" + RandomRankBuilder.NAME + "]"); - } return PARSER.apply(parser, context); } diff --git a/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/rank/textsimilarity/TextSimilarityRankRetrieverBuilder.java b/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/rank/textsimilarity/TextSimilarityRankRetrieverBuilder.java index 8d6f45d4ea0a..42248d246d3d 100644 --- a/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/rank/textsimilarity/TextSimilarityRankRetrieverBuilder.java +++ b/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/rank/textsimilarity/TextSimilarityRankRetrieverBuilder.java @@ -8,7 +8,6 @@ package org.elasticsearch.xpack.inference.rank.textsimilarity; import org.apache.lucene.search.ScoreDoc; -import org.elasticsearch.common.ParsingException; import org.elasticsearch.features.NodeFeature; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.license.LicenseUtils; @@ -36,17 +35,8 @@ import static org.elasticsearch.xcontent.ConstructingObjectParser.optionalConstr */ public class TextSimilarityRankRetrieverBuilder extends CompoundRetrieverBuilder { - public static final NodeFeature TEXT_SIMILARITY_RERANKER_RETRIEVER_SUPPORTED = new NodeFeature( - "text_similarity_reranker_retriever_supported", - true - ); - public static final NodeFeature TEXT_SIMILARITY_RERANKER_COMPOSITION_SUPPORTED = new NodeFeature( - "text_similarity_reranker_retriever_composition_supported", - true - ); public static final NodeFeature TEXT_SIMILARITY_RERANKER_ALIAS_HANDLING_FIX = new NodeFeature( - "text_similarity_reranker_alias_handling_fix", - true + "text_similarity_reranker_alias_handling_fix" ); public static final ParseField RETRIEVER_FIELD = new ParseField("retriever"); @@ -83,14 +73,6 @@ public class TextSimilarityRankRetrieverBuilder extends CompoundRetrieverBuilder RetrieverParserContext context, XPackLicenseState licenceState ) throws IOException { - if (context.clusterSupportsFeature(TEXT_SIMILARITY_RERANKER_RETRIEVER_SUPPORTED) == false) { - throw new ParsingException(parser.getTokenLocation(), "unknown retriever [" + TextSimilarityRankBuilder.NAME + "]"); - } - if (context.clusterSupportsFeature(TEXT_SIMILARITY_RERANKER_COMPOSITION_SUPPORTED) == false) { - throw new IllegalArgumentException( - "[text_similarity_reranker] retriever composition feature is not supported by all nodes in the cluster" - ); - } if (TextSimilarityRankBuilder.TEXT_SIMILARITY_RERANKER_FEATURE.check(licenceState) == false) { throw LicenseUtils.newComplianceException(TextSimilarityRankBuilder.NAME); } diff --git a/x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/rank/random/RandomRankRetrieverBuilderTests.java b/x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/rank/random/RandomRankRetrieverBuilderTests.java index b4cc699334a8..2d91877da97b 100644 --- a/x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/rank/random/RandomRankRetrieverBuilderTests.java +++ b/x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/rank/random/RandomRankRetrieverBuilderTests.java @@ -8,6 +8,7 @@ package org.elasticsearch.xpack.inference.rank.random; import org.elasticsearch.action.search.SearchRequest; +import org.elasticsearch.core.Predicates; import org.elasticsearch.search.retriever.RetrieverBuilder; import org.elasticsearch.search.retriever.RetrieverParserContext; import org.elasticsearch.search.retriever.TestRetrieverBuilder; @@ -51,7 +52,7 @@ public class RandomRankRetrieverBuilderTests extends AbstractXContentTestCase nf == RandomRankRetrieverBuilder.RANDOM_RERANKER_RETRIEVER_SUPPORTED) + new RetrieverParserContext(new SearchUsage(), Predicates.never()) ); } diff --git a/x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/rank/textsimilarity/TextSimilarityRankRetrieverBuilderTests.java b/x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/rank/textsimilarity/TextSimilarityRankRetrieverBuilderTests.java index b0fa1797490e..b6d455dd233b 100644 --- a/x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/rank/textsimilarity/TextSimilarityRankRetrieverBuilderTests.java +++ b/x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/rank/textsimilarity/TextSimilarityRankRetrieverBuilderTests.java @@ -9,6 +9,7 @@ package org.elasticsearch.xpack.inference.rank.textsimilarity; import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.common.Strings; +import org.elasticsearch.core.Predicates; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.TermQueryBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder; @@ -68,11 +69,7 @@ public class TextSimilarityRankRetrieverBuilderTests extends AbstractXContentTes protected TextSimilarityRankRetrieverBuilder doParseInstance(XContentParser parser) throws IOException { return (TextSimilarityRankRetrieverBuilder) RetrieverBuilder.parseTopLevelRetrieverBuilder( parser, - new RetrieverParserContext( - new SearchUsage(), - nf -> nf == TextSimilarityRankRetrieverBuilder.TEXT_SIMILARITY_RERANKER_RETRIEVER_SUPPORTED - || nf == TextSimilarityRankRetrieverBuilder.TEXT_SIMILARITY_RERANKER_COMPOSITION_SUPPORTED - ) + new RetrieverParserContext(new SearchUsage(), Predicates.never()) ); } diff --git a/x-pack/plugin/inference/src/yamlRestTest/resources/rest-api-spec/test/inference/40_semantic_text_query.yml b/x-pack/plugin/inference/src/yamlRestTest/resources/rest-api-spec/test/inference/40_semantic_text_query.yml index 2f3bcfae600e..71db83e4667d 100644 --- a/x-pack/plugin/inference/src/yamlRestTest/resources/rest-api-spec/test/inference/40_semantic_text_query.yml +++ b/x-pack/plugin/inference/src/yamlRestTest/resources/rest-api-spec/test/inference/40_semantic_text_query.yml @@ -173,10 +173,6 @@ setup: --- "Query using a sparse embedding model via a search inference ID": - - requires: - cluster_features: "semantic_text.search_inference_id" - reason: search_inference_id introduced in 8.16.0 - - skip: features: [ "headers", "close_to" ] @@ -357,10 +353,6 @@ setup: --- "Query using a dense embedding model via a search inference ID": - - requires: - cluster_features: "semantic_text.search_inference_id" - reason: search_inference_id introduced in 8.16.0 - - skip: features: [ "headers", "close_to" ] @@ -737,10 +729,6 @@ setup: --- "Query a field with a search inference ID that uses the wrong task type": - - requires: - cluster_features: "semantic_text.search_inference_id" - reason: search_inference_id introduced in 8.16.0 - - do: indices.put_mapping: index: test-sparse-index @@ -778,10 +766,6 @@ setup: --- "Query a field with a search inference ID that uses the wrong dimension count": - - requires: - cluster_features: "semantic_text.search_inference_id" - reason: search_inference_id introduced in 8.16.0 - - do: inference.put: task_type: text_embedding @@ -835,10 +819,6 @@ setup: --- "Query a field with an invalid search inference ID": - - requires: - cluster_features: "semantic_text.search_inference_id" - reason: search_inference_id introduced in 8.16.0 - - do: indices.put_mapping: index: test-dense-index diff --git a/x-pack/plugin/inference/src/yamlRestTest/resources/rest-api-spec/test/inference/70_text_similarity_rank_retriever.yml b/x-pack/plugin/inference/src/yamlRestTest/resources/rest-api-spec/test/inference/70_text_similarity_rank_retriever.yml index a3c55dfddf61..88569daaa607 100644 --- a/x-pack/plugin/inference/src/yamlRestTest/resources/rest-api-spec/test/inference/70_text_similarity_rank_retriever.yml +++ b/x-pack/plugin/inference/src/yamlRestTest/resources/rest-api-spec/test/inference/70_text_similarity_rank_retriever.yml @@ -4,8 +4,6 @@ setup: - close_to - contains - requires: - cluster_features: "text_similarity_reranker_retriever_supported" - reason: semantic reranking introduced in 8.15.0 test_runner_features: "close_to" - do: diff --git a/x-pack/plugin/logsdb/src/main/java/org/elasticsearch/xpack/logsdb/LogsDBUsageTransportAction.java b/x-pack/plugin/logsdb/src/main/java/org/elasticsearch/xpack/logsdb/LogsDBUsageTransportAction.java index cdf02273b9df..19f5039a1075 100644 --- a/x-pack/plugin/logsdb/src/main/java/org/elasticsearch/xpack/logsdb/LogsDBUsageTransportAction.java +++ b/x-pack/plugin/logsdb/src/main/java/org/elasticsearch/xpack/logsdb/LogsDBUsageTransportAction.java @@ -14,7 +14,6 @@ import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.features.FeatureService; import org.elasticsearch.index.IndexMode; import org.elasticsearch.index.IndexSettings; import org.elasticsearch.index.mapper.SourceFieldMapper; @@ -24,7 +23,6 @@ import org.elasticsearch.protocol.xpack.XPackUsageRequest; import org.elasticsearch.tasks.Task; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.xpack.core.XPackFeatures; import org.elasticsearch.xpack.core.action.XPackUsageFeatureAction; import org.elasticsearch.xpack.core.action.XPackUsageFeatureResponse; import org.elasticsearch.xpack.core.action.XPackUsageFeatureTransportAction; @@ -32,14 +30,12 @@ import org.elasticsearch.xpack.core.application.LogsDBFeatureSetUsage; public class LogsDBUsageTransportAction extends XPackUsageFeatureTransportAction { private final ClusterService clusterService; - private final FeatureService featureService; private final Client client; @Inject public LogsDBUsageTransportAction( TransportService transportService, ClusterService clusterService, - FeatureService featureService, ThreadPool threadPool, ActionFilters actionFilters, Client client, @@ -54,7 +50,6 @@ public class LogsDBUsageTransportAction extends XPackUsageFeatureTransportAction indexNameExpressionResolver ); this.clusterService = clusterService; - this.featureService = featureService; this.client = client; } @@ -77,31 +72,23 @@ public class LogsDBUsageTransportAction extends XPackUsageFeatureTransportAction } final boolean enabled = LogsDBPlugin.CLUSTER_LOGSDB_ENABLED.get(clusterService.getSettings()); final boolean hasCustomCutoffDate = System.getProperty(SyntheticSourceLicenseService.CUTOFF_DATE_SYS_PROP_NAME) != null; - if (featureService.clusterHasFeature(state, XPackFeatures.LOGSDB_TELMETRY_STATS)) { - final DiscoveryNode[] nodes = state.nodes().getDataNodes().values().toArray(DiscoveryNode[]::new); - final var statsRequest = new IndexModeStatsActionType.StatsRequest(nodes); - final int finalNumIndices = numIndices; - final int finalNumIndicesWithSyntheticSources = numIndicesWithSyntheticSources; - client.execute(IndexModeStatsActionType.TYPE, statsRequest, listener.map(statsResponse -> { - final var indexStats = statsResponse.stats().get(IndexMode.LOGSDB); - return new XPackUsageFeatureResponse( - new LogsDBFeatureSetUsage( - true, - enabled, - finalNumIndices, - finalNumIndicesWithSyntheticSources, - indexStats.numDocs(), - indexStats.numBytes(), - hasCustomCutoffDate - ) - ); - })); - } else { - listener.onResponse( - new XPackUsageFeatureResponse( - new LogsDBFeatureSetUsage(true, enabled, numIndices, numIndicesWithSyntheticSources, 0L, 0L, hasCustomCutoffDate) + final DiscoveryNode[] nodes = state.nodes().getDataNodes().values().toArray(DiscoveryNode[]::new); + final var statsRequest = new IndexModeStatsActionType.StatsRequest(nodes); + final int finalNumIndices = numIndices; + final int finalNumIndicesWithSyntheticSources = numIndicesWithSyntheticSources; + client.execute(IndexModeStatsActionType.TYPE, statsRequest, listener.map(statsResponse -> { + final var indexStats = statsResponse.stats().get(IndexMode.LOGSDB); + return new XPackUsageFeatureResponse( + new LogsDBFeatureSetUsage( + true, + enabled, + finalNumIndices, + finalNumIndicesWithSyntheticSources, + indexStats.numDocs(), + indexStats.numBytes(), + hasCustomCutoffDate ) ); - } + })); } } diff --git a/x-pack/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFFeatures.java b/x-pack/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFFeatures.java index bb61fa951948..494eaa508c14 100644 --- a/x-pack/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFFeatures.java +++ b/x-pack/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFFeatures.java @@ -13,18 +13,12 @@ import org.elasticsearch.features.NodeFeature; import java.util.Set; import static org.elasticsearch.search.retriever.CompoundRetrieverBuilder.INNER_RETRIEVERS_FILTER_SUPPORT; -import static org.elasticsearch.xpack.rank.rrf.RRFRetrieverBuilder.RRF_RETRIEVER_COMPOSITION_SUPPORTED; /** * A set of features specifically for the rrf plugin. */ public class RRFFeatures implements FeatureSpecification { - @Override - public Set getFeatures() { - return Set.of(RRFRetrieverBuilder.RRF_RETRIEVER_SUPPORTED, RRF_RETRIEVER_COMPOSITION_SUPPORTED); - } - @Override public Set getTestFeatures() { return Set.of(INNER_RETRIEVERS_FILTER_SUPPORT); diff --git a/x-pack/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFRankBuilder.java b/x-pack/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFRankBuilder.java index b5bca5747868..91bc19a3e090 100644 --- a/x-pack/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFRankBuilder.java +++ b/x-pack/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFRankBuilder.java @@ -194,9 +194,6 @@ public class RRFRankBuilder extends RankBuilder { @Override public RetrieverBuilder toRetriever(SearchSourceBuilder source, Predicate clusterSupportsFeature) { - if (false == clusterSupportsFeature.test(RRFRetrieverBuilder.RRF_RETRIEVER_COMPOSITION_SUPPORTED)) { - return null; - } int totalQueries = source.subSearches().size() + source.knnSearch().size(); if (totalQueries < 2) { throw new IllegalArgumentException("[rrf] requires at least 2 sub-queries to be defined"); diff --git a/x-pack/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFRetrieverBuilder.java b/x-pack/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFRetrieverBuilder.java index 186febfda18f..a749a7c402c3 100644 --- a/x-pack/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFRetrieverBuilder.java +++ b/x-pack/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFRetrieverBuilder.java @@ -8,9 +8,7 @@ package org.elasticsearch.xpack.rank.rrf; import org.apache.lucene.search.ScoreDoc; -import org.elasticsearch.common.ParsingException; import org.elasticsearch.common.util.Maps; -import org.elasticsearch.features.NodeFeature; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.license.LicenseUtils; import org.elasticsearch.search.rank.RankBuilder; @@ -44,8 +42,6 @@ import static org.elasticsearch.xcontent.ConstructingObjectParser.optionalConstr public final class RRFRetrieverBuilder extends CompoundRetrieverBuilder { public static final String NAME = "rrf"; - public static final NodeFeature RRF_RETRIEVER_SUPPORTED = new NodeFeature("rrf_retriever_supported", true); - public static final NodeFeature RRF_RETRIEVER_COMPOSITION_SUPPORTED = new NodeFeature("rrf_retriever_composition_supported", true); public static final ParseField RETRIEVERS_FIELD = new ParseField("retrievers"); public static final ParseField RANK_CONSTANT_FIELD = new ParseField("rank_constant"); @@ -79,12 +75,6 @@ public final class RRFRetrieverBuilder extends CompoundRetrieverBuilder ssb.parseXContent(parser, true, Predicates.never())); - assertEquals("unknown retriever [rrf]", iae.getMessage()); - } - } - /** Tests extraction errors related to compound retrievers. These tests require a compound retriever which is why they are here. */ public void testRetrieverExtractionErrors() throws IOException { try ( diff --git a/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/300_rrf_retriever.yml b/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/300_rrf_retriever.yml index 258ab70cd09b..ac328967d9fc 100644 --- a/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/300_rrf_retriever.yml +++ b/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/300_rrf_retriever.yml @@ -1,8 +1,4 @@ setup: - - requires: - cluster_features: 'rrf_retriever_supported' - reason: 'test requires rrf retriever implementation' - - do: indices.create: index: test diff --git a/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/350_rrf_retriever_pagination.yml b/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/350_rrf_retriever_pagination.yml index d5d7a5de1dc7..e7a4bf8a5b34 100644 --- a/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/350_rrf_retriever_pagination.yml +++ b/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/350_rrf_retriever_pagination.yml @@ -4,10 +4,6 @@ setup: - close_to - contains - - requires: - cluster_features: 'rrf_retriever_composition_supported' - reason: 'test requires rrf retriever composition support' - - do: indices.create: index: test diff --git a/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/400_rrf_retriever_script.yml b/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/400_rrf_retriever_script.yml index bbc1087b05cc..4dea4c356873 100644 --- a/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/400_rrf_retriever_script.yml +++ b/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/400_rrf_retriever_script.yml @@ -2,10 +2,6 @@ setup: - skip: features: close_to - - requires: - cluster_features: 'rrf_retriever_supported' - reason: 'test requires rrf retriever implementation' - - do: indices.create: index: test diff --git a/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/600_rrf_retriever_profile.yml b/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/600_rrf_retriever_profile.yml index 24259e3aa2a8..b1c5ec1664c8 100644 --- a/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/600_rrf_retriever_profile.yml +++ b/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/600_rrf_retriever_profile.yml @@ -1,7 +1,5 @@ setup: - requires: - cluster_features: 'rrf_retriever_composition_supported' - reason: 'test requires rrf retriever composition support' test_runner_features: close_to - do: diff --git a/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/700_rrf_retriever_search_api_compatibility.yml b/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/700_rrf_retriever_search_api_compatibility.yml index cb30542d8000..01d645fbfb4f 100644 --- a/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/700_rrf_retriever_search_api_compatibility.yml +++ b/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/700_rrf_retriever_search_api_compatibility.yml @@ -1,9 +1,6 @@ setup: - skip: features: close_to - - requires: - cluster_features: 'rrf_retriever_composition_supported' - reason: 'test requires rrf retriever composition support' - do: indices.create: diff --git a/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/800_rrf_with_text_similarity_reranker_retriever.yml b/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/800_rrf_with_text_similarity_reranker_retriever.yml index d9db1fe38762..98c4ae9e642d 100644 --- a/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/800_rrf_with_text_similarity_reranker_retriever.yml +++ b/x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/800_rrf_with_text_similarity_reranker_retriever.yml @@ -5,8 +5,6 @@ setup: - contains - requires: - cluster_features: ['rrf_retriever_composition_supported', 'text_similarity_reranker_retriever_supported'] - reason: need to have support for rrf and semantic reranking composition test_runner_features: "close_to" - do: diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/SecurityFeatures.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/SecurityFeatures.java index 84749d895a44..409ab62ae3e7 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/SecurityFeatures.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/SecurityFeatures.java @@ -13,19 +13,11 @@ import org.elasticsearch.features.NodeFeature; import java.util.Set; import static org.elasticsearch.xpack.security.support.QueryableBuiltInRolesSynchronizer.QUERYABLE_BUILT_IN_ROLES_FEATURE; -import static org.elasticsearch.xpack.security.support.SecuritySystemIndices.SECURITY_MIGRATION_FRAMEWORK; -import static org.elasticsearch.xpack.security.support.SecuritySystemIndices.SECURITY_ROLES_METADATA_FLATTENED; -import static org.elasticsearch.xpack.security.support.SecuritySystemIndices.SECURITY_ROLE_MAPPING_CLEANUP; public class SecurityFeatures implements FeatureSpecification { @Override public Set getFeatures() { - return Set.of( - SECURITY_ROLE_MAPPING_CLEANUP, - SECURITY_ROLES_METADATA_FLATTENED, - SECURITY_MIGRATION_FRAMEWORK, - QUERYABLE_BUILT_IN_ROLES_FEATURE - ); + return Set.of(QUERYABLE_BUILT_IN_ROLES_FEATURE); } } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/store/NativeRolesStore.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/store/NativeRolesStore.java index 0a5865ecfe9b..dc20b1e28ba7 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/store/NativeRolesStore.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/store/NativeRolesStore.java @@ -96,7 +96,6 @@ import static org.elasticsearch.xpack.security.support.SecurityIndexManager.Avai import static org.elasticsearch.xpack.security.support.SecurityIndexManager.Availability.SEARCH_SHARDS; import static org.elasticsearch.xpack.security.support.SecurityMigrations.ROLE_METADATA_FLATTENED_MIGRATION_VERSION; import static org.elasticsearch.xpack.security.support.SecuritySystemIndices.SECURITY_MAIN_ALIAS; -import static org.elasticsearch.xpack.security.support.SecuritySystemIndices.SECURITY_ROLES_METADATA_FLATTENED; /** * NativeRolesStore is a {@code RolesStore} that, instead of reading from a @@ -652,9 +651,7 @@ public class NativeRolesStore implements BiConsumer, ActionListener< XContentBuilder builder = jsonBuilder().startObject(); role.innerToXContent(builder, ToXContent.EMPTY_PARAMS, true); - if (featureService.clusterHasFeature(clusterService.state(), SECURITY_ROLES_METADATA_FLATTENED)) { - builder.field(RoleDescriptor.Fields.METADATA_FLATTENED.getPreferredName(), role.getMetadata()); - } + builder.field(RoleDescriptor.Fields.METADATA_FLATTENED.getPreferredName(), role.getMetadata()); // When role descriptor XContent is generated for the security index all empty fields need to have default values to make sure // existing values are overwritten if not present since the request to update could be an UpdateRequest diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/SecurityIndexManager.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/SecurityIndexManager.java index 78f7209c06e3..39c7a45d51df 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/SecurityIndexManager.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/SecurityIndexManager.java @@ -69,7 +69,6 @@ import static org.elasticsearch.xpack.core.ClientHelper.executeAsyncWithOrigin; import static org.elasticsearch.xpack.core.security.action.UpdateIndexMigrationVersionAction.MIGRATION_VERSION_CUSTOM_DATA_KEY; import static org.elasticsearch.xpack.core.security.action.UpdateIndexMigrationVersionAction.MIGRATION_VERSION_CUSTOM_KEY; import static org.elasticsearch.xpack.security.support.SecurityIndexManager.State.UNRECOVERED_STATE; -import static org.elasticsearch.xpack.security.support.SecuritySystemIndices.SECURITY_MIGRATION_FRAMEWORK; /** * Manages the lifecycle, mapping and data upgrades/migrations of the {@code RestrictedIndicesNames#SECURITY_MAIN_ALIAS} @@ -539,7 +538,6 @@ public class SecurityIndexManager implements ClusterStateListener { && state.indexAvailableForSearch && state.isIndexUpToDate && state.indexExists() - && state.securityFeatures.contains(SECURITY_MIGRATION_FRAMEWORK) && isEligibleSecurityMigration(securityMigration); } diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/SecurityMigrations.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/SecurityMigrations.java index 203dec9e25b9..c380b9fbee93 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/SecurityMigrations.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/SecurityMigrations.java @@ -142,7 +142,7 @@ public class SecurityMigrations { @Override public Set nodeFeaturesRequired() { - return Set.of(SecuritySystemIndices.SECURITY_ROLES_METADATA_FLATTENED); + return Set.of(); } @Override @@ -221,7 +221,7 @@ public class SecurityMigrations { @Override public Set nodeFeaturesRequired() { - return Set.of(SecuritySystemIndices.SECURITY_ROLE_MAPPING_CLEANUP); + return Set.of(); } @Override diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/SecuritySystemIndices.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/SecuritySystemIndices.java index bf3ecd1feeec..806b545b8577 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/SecuritySystemIndices.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/SecuritySystemIndices.java @@ -17,7 +17,6 @@ import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.VersionId; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.features.FeatureService; -import org.elasticsearch.features.NodeFeature; import org.elasticsearch.index.IndexSettings; import org.elasticsearch.indices.ExecutorNames; import org.elasticsearch.indices.SystemIndexDescriptor; @@ -56,9 +55,6 @@ public class SecuritySystemIndices { public static final String INTERNAL_SECURITY_PROFILE_INDEX_8 = ".security-profile-8"; public static final String SECURITY_PROFILE_ALIAS = ".security-profile"; - public static final NodeFeature SECURITY_MIGRATION_FRAMEWORK = new NodeFeature("security.migration_framework", true); - public static final NodeFeature SECURITY_ROLES_METADATA_FLATTENED = new NodeFeature("security.roles_metadata_flattened", true); - public static final NodeFeature SECURITY_ROLE_MAPPING_CLEANUP = new NodeFeature("security.role_mapping_cleanup", true); /** * Security managed index mappings used to be updated based on the product version. They are now updated based on per-index mappings diff --git a/x-pack/plugin/slm/src/main/java/org/elasticsearch/xpack/slm/SnapshotLifecycle.java b/x-pack/plugin/slm/src/main/java/org/elasticsearch/xpack/slm/SnapshotLifecycle.java index cc01d5b10110..3c7e9310744c 100644 --- a/x-pack/plugin/slm/src/main/java/org/elasticsearch/xpack/slm/SnapshotLifecycle.java +++ b/x-pack/plugin/slm/src/main/java/org/elasticsearch/xpack/slm/SnapshotLifecycle.java @@ -237,7 +237,7 @@ public class SnapshotLifecycle extends Plugin implements ActionPlugin, HealthPlu } List> reservedClusterStateHandlers() { - return List.of(new ReservedSnapshotAction(featureService.get())); + return List.of(new ReservedSnapshotAction()); } @Override diff --git a/x-pack/plugin/slm/src/main/java/org/elasticsearch/xpack/slm/SnapshotLifecycleFeatures.java b/x-pack/plugin/slm/src/main/java/org/elasticsearch/xpack/slm/SnapshotLifecycleFeatures.java index 274dec75865a..ca4a632f7a76 100644 --- a/x-pack/plugin/slm/src/main/java/org/elasticsearch/xpack/slm/SnapshotLifecycleFeatures.java +++ b/x-pack/plugin/slm/src/main/java/org/elasticsearch/xpack/slm/SnapshotLifecycleFeatures.java @@ -15,6 +15,6 @@ import java.util.Set; public class SnapshotLifecycleFeatures implements FeatureSpecification { @Override public Set getFeatures() { - return Set.of(SnapshotLifecycleService.INTERVAL_SCHEDULE); + return Set.of(); } } diff --git a/x-pack/plugin/slm/src/main/java/org/elasticsearch/xpack/slm/SnapshotLifecycleService.java b/x-pack/plugin/slm/src/main/java/org/elasticsearch/xpack/slm/SnapshotLifecycleService.java index e53c167c5790..2c14e0804d1f 100644 --- a/x-pack/plugin/slm/src/main/java/org/elasticsearch/xpack/slm/SnapshotLifecycleService.java +++ b/x-pack/plugin/slm/src/main/java/org/elasticsearch/xpack/slm/SnapshotLifecycleService.java @@ -20,8 +20,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.ConcurrentCollections; import org.elasticsearch.core.SuppressForbidden; import org.elasticsearch.core.TimeValue; -import org.elasticsearch.features.FeatureService; -import org.elasticsearch.features.NodeFeature; import org.elasticsearch.xpack.core.ilm.LifecycleSettings; import org.elasticsearch.xpack.core.ilm.OperationMode; import org.elasticsearch.xpack.core.ilm.OperationModeUpdateTask; @@ -46,7 +44,6 @@ import static org.elasticsearch.xpack.core.ilm.LifecycleOperationMetadata.curren * task according to the policy's schedule. */ public class SnapshotLifecycleService implements Closeable, ClusterStateListener { - public static final NodeFeature INTERVAL_SCHEDULE = new NodeFeature("slm.interval_schedule", true); private static final Logger logger = LogManager.getLogger(SnapshotLifecycleService.class); private static final String JOB_PATTERN_SUFFIX = "-\\d+$"; @@ -261,18 +258,6 @@ public class SnapshotLifecycleService implements Closeable, ClusterStateListener } } - /** - * Validate that interval schedule feature is not supported by all nodes - * @throws IllegalArgumentException if is interval expression but interval schedule not supported - */ - public static void validateIntervalScheduleSupport(String schedule, FeatureService featureService, ClusterState state) { - if (SnapshotLifecyclePolicy.isIntervalSchedule(schedule) && featureService.clusterHasFeature(state, INTERVAL_SCHEDULE) == false) { - throw new IllegalArgumentException( - "Unable to use slm interval schedules in mixed-clusters with nodes that do not support feature " + INTERVAL_SCHEDULE.id() - ); - } - } - @Override public void close() { if (this.running.compareAndSet(true, false)) { diff --git a/x-pack/plugin/slm/src/main/java/org/elasticsearch/xpack/slm/action/ReservedSnapshotAction.java b/x-pack/plugin/slm/src/main/java/org/elasticsearch/xpack/slm/action/ReservedSnapshotAction.java index a98e110ed88d..b915f26310c1 100644 --- a/x-pack/plugin/slm/src/main/java/org/elasticsearch/xpack/slm/action/ReservedSnapshotAction.java +++ b/x-pack/plugin/slm/src/main/java/org/elasticsearch/xpack/slm/action/ReservedSnapshotAction.java @@ -9,7 +9,6 @@ package org.elasticsearch.xpack.slm.action; import org.elasticsearch.action.ActionListener; import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.features.FeatureService; import org.elasticsearch.reservedstate.ReservedClusterStateHandler; import org.elasticsearch.reservedstate.TransformState; import org.elasticsearch.xcontent.XContentParser; @@ -41,12 +40,6 @@ public class ReservedSnapshotAction implements ReservedClusterStateHandler { private static final Logger logger = LogManager.getLogger(TransportPutSnapshotLifecycleAction.class); - private final FeatureService featureService; @Inject public TransportPutSnapshotLifecycleAction( @@ -58,8 +56,7 @@ public class TransportPutSnapshotLifecycleAction extends TransportMasterNodeActi ClusterService clusterService, ThreadPool threadPool, ActionFilters actionFilters, - IndexNameExpressionResolver indexNameExpressionResolver, - FeatureService featureService + IndexNameExpressionResolver indexNameExpressionResolver ) { super( PutSnapshotLifecycleAction.NAME, @@ -72,7 +69,6 @@ public class TransportPutSnapshotLifecycleAction extends TransportMasterNodeActi AcknowledgedResponse::readFrom, EsExecutors.DIRECT_EXECUTOR_SERVICE ); - this.featureService = featureService; } @Override @@ -82,7 +78,6 @@ public class TransportPutSnapshotLifecycleAction extends TransportMasterNodeActi final ClusterState state, final ActionListener listener ) { - SnapshotLifecycleService.validateIntervalScheduleSupport(request.getLifecycle().getSchedule(), featureService, state); SnapshotLifecycleService.validateRepositoryExists(request.getLifecycle().getRepository(), state); SnapshotLifecycleService.validateMinimumInterval(request.getLifecycle(), state); diff --git a/x-pack/plugin/slm/src/test/java/org/elasticsearch/xpack/slm/SnapshotLifecycleServiceTests.java b/x-pack/plugin/slm/src/test/java/org/elasticsearch/xpack/slm/SnapshotLifecycleServiceTests.java index 9955fe4cf0f9..b48a3be0728e 100644 --- a/x-pack/plugin/slm/src/test/java/org/elasticsearch/xpack/slm/SnapshotLifecycleServiceTests.java +++ b/x-pack/plugin/slm/src/test/java/org/elasticsearch/xpack/slm/SnapshotLifecycleServiceTests.java @@ -27,7 +27,6 @@ import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.core.TimeValue; -import org.elasticsearch.features.FeatureService; import org.elasticsearch.test.ClusterServiceUtils; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.threadpool.TestThreadPool; @@ -50,7 +49,6 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; @@ -525,44 +523,6 @@ public class SnapshotLifecycleServiceTests extends ESTestCase { } } - public void testValidateIntervalScheduleSupport() { - var featureService = new FeatureService(List.of(new SnapshotLifecycleFeatures())); - { - ClusterState state = ClusterState.builder(new ClusterName("cluster")) - .nodes(DiscoveryNodes.builder().add(DiscoveryNodeUtils.create("a")).add(DiscoveryNodeUtils.create("b"))) - .nodeFeatures(Map.of("a", Set.of(), "b", Set.of(SnapshotLifecycleService.INTERVAL_SCHEDULE.id()))) - .build(); - - IllegalArgumentException e = expectThrows( - IllegalArgumentException.class, - () -> SnapshotLifecycleService.validateIntervalScheduleSupport("30d", featureService, state) - ); - assertThat(e.getMessage(), containsString("Unable to use slm interval schedules")); - } - { - ClusterState state = ClusterState.builder(new ClusterName("cluster")) - .nodes(DiscoveryNodes.builder().add(DiscoveryNodeUtils.create("a"))) - .nodeFeatures(Map.of("a", Set.of(SnapshotLifecycleService.INTERVAL_SCHEDULE.id()))) - .build(); - try { - SnapshotLifecycleService.validateIntervalScheduleSupport("30d", featureService, state); - } catch (Exception e) { - fail("interval schedule is supported by version and should not fail"); - } - } - { - ClusterState state = ClusterState.builder(new ClusterName("cluster")) - .nodes(DiscoveryNodes.builder().add(DiscoveryNodeUtils.create("a")).add(DiscoveryNodeUtils.create("b"))) - .nodeFeatures(Map.of("a", Set.of(), "b", Set.of(SnapshotLifecycleService.INTERVAL_SCHEDULE.id()))) - .build(); - try { - SnapshotLifecycleService.validateIntervalScheduleSupport("*/1 * * * * ?", featureService, state); - } catch (Exception e) { - fail("cron schedule does not need feature check and should not fail"); - } - } - } - class FakeSnapshotTask extends SnapshotLifecycleTask { private final Consumer onTriggered; diff --git a/x-pack/plugin/slm/src/test/java/org/elasticsearch/xpack/slm/action/ReservedSnapshotLifecycleStateServiceTests.java b/x-pack/plugin/slm/src/test/java/org/elasticsearch/xpack/slm/action/ReservedSnapshotLifecycleStateServiceTests.java index b993633e3d17..e61e73d656ca 100644 --- a/x-pack/plugin/slm/src/test/java/org/elasticsearch/xpack/slm/action/ReservedSnapshotLifecycleStateServiceTests.java +++ b/x-pack/plugin/slm/src/test/java/org/elasticsearch/xpack/slm/action/ReservedSnapshotLifecycleStateServiceTests.java @@ -24,7 +24,6 @@ import org.elasticsearch.cluster.service.MasterServiceTaskQueue; import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.core.Releasable; -import org.elasticsearch.features.FeatureService; import org.elasticsearch.repositories.RepositoriesService; import org.elasticsearch.reservedstate.TransformState; import org.elasticsearch.reservedstate.action.ReservedClusterSettingsAction; @@ -81,7 +80,7 @@ public class ReservedSnapshotLifecycleStateServiceTests extends ESTestCase { } public void testDependencies() { - var action = new ReservedSnapshotAction(mock(FeatureService.class)); + var action = new ReservedSnapshotAction(); assertThat(action.optionalDependencies(), contains(ReservedRepositoryAction.NAME)); } @@ -91,7 +90,7 @@ public class ReservedSnapshotLifecycleStateServiceTests extends ESTestCase { final ClusterName clusterName = new ClusterName("elasticsearch"); ClusterState state = ClusterState.builder(clusterName).build(); - ReservedSnapshotAction action = new ReservedSnapshotAction(mock(FeatureService.class)); + ReservedSnapshotAction action = new ReservedSnapshotAction(); TransformState prevState = new TransformState(state, Set.of()); String badPolicyJSON = """ @@ -119,56 +118,6 @@ public class ReservedSnapshotLifecycleStateServiceTests extends ESTestCase { ); } - public void testIntervalScheduleSupportValidation() { - Client client = mock(Client.class); - when(client.settings()).thenReturn(Settings.EMPTY); - final ClusterName clusterName = new ClusterName("elasticsearch"); - List repositoriesMetadata = List.of(new RepositoryMetadata("repo", "fs", Settings.EMPTY)); - Metadata.Builder mdBuilder = Metadata.builder(); - mdBuilder.putCustom(RepositoriesMetadata.TYPE, new RepositoriesMetadata(repositoriesMetadata)); - ClusterState state = ClusterState.builder(clusterName).metadata(mdBuilder).build(); - TransformState prevState = new TransformState(state, Set.of()); - String goodPolicyJSON = """ - { - "daily-snapshots": { - "schedule": "30d", - "name": "", - "repository": "repo", - "config": { - "indices": ["foo-*", "important"], - "ignore_unavailable": true, - "include_global_state": false - }, - "retention": { - "expire_after": "30d", - "min_count": 1, - "max_count": 50 - } - } - } - """; - - { - FeatureService featureService = mock(FeatureService.class); - when(featureService.clusterHasFeature(any(), any())).thenReturn(false); - ReservedSnapshotAction action = new ReservedSnapshotAction(featureService); - assertThat( - expectThrows(IllegalArgumentException.class, () -> processJSON(action, prevState, goodPolicyJSON)).getMessage(), - is("Error on validating SLM requests") - ); - } - { - FeatureService featureService = mock(FeatureService.class); - when(featureService.clusterHasFeature(any(), any())).thenReturn(true); - ReservedSnapshotAction action = new ReservedSnapshotAction(featureService); - try { - processJSON(action, prevState, goodPolicyJSON); - } catch (Exception e) { - fail("interval schedule with interval feature should pass validation"); - } - } - } - public void testActionAddRemove() throws Exception { Client client = mock(Client.class); when(client.settings()).thenReturn(Settings.EMPTY); @@ -180,7 +129,7 @@ public class ReservedSnapshotLifecycleStateServiceTests extends ESTestCase { mdBuilder.putCustom(RepositoriesMetadata.TYPE, new RepositoriesMetadata(repositoriesMetadata)); ClusterState state = ClusterState.builder(clusterName).metadata(mdBuilder).build(); - ReservedSnapshotAction action = new ReservedSnapshotAction(mock(FeatureService.class)); + ReservedSnapshotAction action = new ReservedSnapshotAction(); String emptyJSON = ""; @@ -414,7 +363,7 @@ public class ReservedSnapshotLifecycleStateServiceTests extends ESTestCase { null, List.of( new ReservedClusterSettingsAction(clusterSettings), - new ReservedSnapshotAction(mock(FeatureService.class)), + new ReservedSnapshotAction(), new ReservedRepositoryAction(repositoriesService) ) ); @@ -448,8 +397,7 @@ public class ReservedSnapshotLifecycleStateServiceTests extends ESTestCase { mock(ClusterService.class), threadPool, mock(ActionFilters.class), - mock(IndexNameExpressionResolver.class), - mock(FeatureService.class) + mock(IndexNameExpressionResolver.class) ); assertThat(putAction.reservedStateHandlerName().get(), equalTo(ReservedSnapshotAction.NAME)); diff --git a/x-pack/plugin/snapshot-repo-test-kit/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/20_verify_integrity.yml b/x-pack/plugin/snapshot-repo-test-kit/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/20_verify_integrity.yml index be6929a15ff4..18707ea2d1d8 100644 --- a/x-pack/plugin/snapshot-repo-test-kit/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/20_verify_integrity.yml +++ b/x-pack/plugin/snapshot-repo-test-kit/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/20_verify_integrity.yml @@ -1,9 +1,5 @@ --- setup: - - requires: - cluster_features: "snapshot.repository_verify_integrity" - reason: "required feature" - - do: snapshot.create_repository: repository: test_repo diff --git a/x-pack/plugin/snapshot-repo-test-kit/src/main/java/module-info.java b/x-pack/plugin/snapshot-repo-test-kit/src/main/java/module-info.java index 70385cdc4cf0..e2c3df252ae2 100644 --- a/x-pack/plugin/snapshot-repo-test-kit/src/main/java/module-info.java +++ b/x-pack/plugin/snapshot-repo-test-kit/src/main/java/module-info.java @@ -17,8 +17,4 @@ module org.elasticsearch.repositories.blobstore.testkit { exports org.elasticsearch.repositories.blobstore.testkit.analyze; exports org.elasticsearch.repositories.blobstore.testkit.integrity; - - provides org.elasticsearch.features.FeatureSpecification - with - org.elasticsearch.repositories.blobstore.testkit.SnapshotRepositoryTestKitFeatures; } diff --git a/x-pack/plugin/snapshot-repo-test-kit/src/main/java/org/elasticsearch/repositories/blobstore/testkit/SnapshotRepositoryTestKitFeatures.java b/x-pack/plugin/snapshot-repo-test-kit/src/main/java/org/elasticsearch/repositories/blobstore/testkit/SnapshotRepositoryTestKitFeatures.java deleted file mode 100644 index cc513a948519..000000000000 --- a/x-pack/plugin/snapshot-repo-test-kit/src/main/java/org/elasticsearch/repositories/blobstore/testkit/SnapshotRepositoryTestKitFeatures.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -package org.elasticsearch.repositories.blobstore.testkit; - -import org.elasticsearch.features.FeatureSpecification; -import org.elasticsearch.features.NodeFeature; - -import java.util.Set; - -import static org.elasticsearch.repositories.blobstore.testkit.integrity.RestRepositoryVerifyIntegrityAction.REPOSITORY_VERIFY_INTEGRITY_FEATURE; - -public class SnapshotRepositoryTestKitFeatures implements FeatureSpecification { - @Override - public Set getFeatures() { - return Set.of(REPOSITORY_VERIFY_INTEGRITY_FEATURE); - } -} diff --git a/x-pack/plugin/snapshot-repo-test-kit/src/main/java/org/elasticsearch/repositories/blobstore/testkit/integrity/RestRepositoryVerifyIntegrityAction.java b/x-pack/plugin/snapshot-repo-test-kit/src/main/java/org/elasticsearch/repositories/blobstore/testkit/integrity/RestRepositoryVerifyIntegrityAction.java index b07358ab861a..53db8efde9ea 100644 --- a/x-pack/plugin/snapshot-repo-test-kit/src/main/java/org/elasticsearch/repositories/blobstore/testkit/integrity/RestRepositoryVerifyIntegrityAction.java +++ b/x-pack/plugin/snapshot-repo-test-kit/src/main/java/org/elasticsearch/repositories/blobstore/testkit/integrity/RestRepositoryVerifyIntegrityAction.java @@ -8,7 +8,6 @@ package org.elasticsearch.repositories.blobstore.testkit.integrity; import org.elasticsearch.client.internal.node.NodeClient; -import org.elasticsearch.features.NodeFeature; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.Scope; @@ -22,8 +21,6 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; @ServerlessScope(Scope.INTERNAL) public class RestRepositoryVerifyIntegrityAction extends BaseRestHandler { - public static final NodeFeature REPOSITORY_VERIFY_INTEGRITY_FEATURE = new NodeFeature("snapshot.repository_verify_integrity", true); - @Override public List routes() { return List.of(new Route(POST, "/_snapshot/{repository}/_verify_integrity")); diff --git a/x-pack/plugin/snapshot-repo-test-kit/src/main/resources/META-INF/services/org.elasticsearch.features.FeatureSpecification b/x-pack/plugin/snapshot-repo-test-kit/src/main/resources/META-INF/services/org.elasticsearch.features.FeatureSpecification deleted file mode 100644 index ae11c3bb39d0..000000000000 --- a/x-pack/plugin/snapshot-repo-test-kit/src/main/resources/META-INF/services/org.elasticsearch.features.FeatureSpecification +++ /dev/null @@ -1,8 +0,0 @@ -# -# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one -# or more contributor license agreements. Licensed under the Elastic License -# 2.0; you may not use this file except in compliance with the Elastic License -# 2.0. -# - -org.elasticsearch.repositories.blobstore.testkit.SnapshotRepositoryTestKitFeatures diff --git a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/logsdb/10_usage.yml b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/logsdb/10_usage.yml index 731082378fe1..b7fdd16111db 100644 --- a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/logsdb/10_usage.yml +++ b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/logsdb/10_usage.yml @@ -1,8 +1,5 @@ --- logsdb usage: - - requires: - cluster_features: ["logsdb_telemetry_stats"] - reason: "requires stats" - do: indices.create: index: test1 diff --git a/x-pack/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/SecurityIndexRoleMappingCleanupIT.java b/x-pack/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/SecurityIndexRoleMappingCleanupIT.java deleted file mode 100644 index 915122c97d3f..000000000000 --- a/x-pack/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/SecurityIndexRoleMappingCleanupIT.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -package org.elasticsearch.upgrades; - -import org.elasticsearch.Version; -import org.elasticsearch.client.Request; -import org.elasticsearch.client.Response; -import org.elasticsearch.client.RestClient; -import org.elasticsearch.common.bytes.BytesReference; -import org.elasticsearch.xpack.core.security.authc.support.mapper.ExpressionRoleMapping; -import org.elasticsearch.xpack.core.security.authz.RoleDescriptor; - -import java.io.IOException; -import java.util.List; -import java.util.Locale; -import java.util.Map; - -import static org.elasticsearch.TransportVersions.V_8_15_0; -import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.Matchers.containsInAnyOrder; - -public class SecurityIndexRoleMappingCleanupIT extends AbstractUpgradeTestCase { - private static final Version UPGRADE_FROM_VERSION = Version.fromString(System.getProperty("tests.upgrade_from_version")); - - public void testCleanupDuplicateMappings() throws Exception { - // see build.gradle where we set operator/settings.json for more details on this skip - assumeTrue( - "Cluster requires version higher than since operator/settings.json is only set then: " + Version.V_8_7_0, - UPGRADE_FROM_VERSION.onOrAfter(Version.V_8_7_0) - ); - if (CLUSTER_TYPE == ClusterType.OLD) { - // If we're in a state where the same operator-defined role mappings can exist both in cluster state and the native store - // (V_8_15_0 transport added to security.role_mapping_cleanup feature added), create a state - // where the native store will need to be cleaned up - assumeTrue( - "Cleanup only needed before security.role_mapping_cleanup feature available in cluster", - clusterHasFeature("security.role_mapping_cleanup") == false - ); - assumeTrue( - "If role mappings are in cluster state but cleanup has not been performed yet, create duplicated role mappings", - minimumTransportVersion().onOrAfter(V_8_15_0) - ); - // Since the old cluster has role mappings in cluster state, but doesn't check duplicates, create duplicates - createNativeRoleMapping("operator_role_mapping_1", Map.of("meta", "test"), true); - createNativeRoleMapping("operator_role_mapping_2", Map.of("meta", "test"), true); - } else if (CLUSTER_TYPE == ClusterType.MIXED) { - // Create a native role mapping that doesn't conflict with anything before the migration run - createNativeRoleMapping("no_name_conflict", Map.of("meta", "test")); - } else if (CLUSTER_TYPE == ClusterType.UPGRADED) { - waitForSecurityMigrationCompletion(adminClient(), 2); - assertAllRoleMappings( - client(), - "operator_role_mapping_1" + ExpressionRoleMapping.READ_ONLY_ROLE_MAPPING_SUFFIX, - "operator_role_mapping_2" + ExpressionRoleMapping.READ_ONLY_ROLE_MAPPING_SUFFIX, - "no_name_conflict" - ); - // In the old cluster we might have created these (depending on the node features), so make sure they were removed - assertFalse(roleMappingExistsInSecurityIndex("operator_role_mapping_1")); - assertFalse(roleMappingExistsInSecurityIndex("operator_role_mapping_2")); - assertTrue(roleMappingExistsInSecurityIndex("no_name_conflict")); - // Make sure we can create and delete a conflicting role mapping again - createNativeRoleMapping("operator_role_mapping_1", Map.of("meta", "test"), true); - deleteNativeRoleMapping("operator_role_mapping_1", true); - } - } - - @SuppressWarnings("unchecked") - private boolean roleMappingExistsInSecurityIndex(String mappingName) throws IOException { - final Request request = new Request("POST", "/.security/_search"); - request.setJsonEntity(String.format(Locale.ROOT, """ - {"query":{"bool":{"must":[{"term":{"_id":"%s_%s"}}]}}}""", "role-mapping", mappingName)); - - request.setOptions( - expectWarnings( - "this request accesses system indices: [.security-7]," - + " but in a future major version, direct access to system indices will be prevented by default" - ) - ); - - Response response = adminClient().performRequest(request); - assertOK(response); - final Map responseMap = responseAsMap(response); - - Map hits = ((Map) responseMap.get("hits")); - return ((List) hits.get("hits")).isEmpty() == false; - } - - private void createNativeRoleMapping(String roleMappingName, Map metadata) throws IOException { - createNativeRoleMapping(roleMappingName, metadata, false); - } - - private void createNativeRoleMapping(String roleMappingName, Map metadata, boolean expectWarning) throws IOException { - final Request request = new Request("POST", "/_security/role_mapping/" + roleMappingName); - if (expectWarning) { - request.setOptions( - expectWarnings( - "A read-only role mapping with the same name [" - + roleMappingName - + "] has been previously defined in a configuration file. " - + "Both role mappings will be used to determine role assignments." - ) - ); - } - - BytesReference source = BytesReference.bytes( - jsonBuilder().map( - Map.of( - ExpressionRoleMapping.Fields.ROLES.getPreferredName(), - List.of("superuser"), - ExpressionRoleMapping.Fields.ENABLED.getPreferredName(), - true, - ExpressionRoleMapping.Fields.RULES.getPreferredName(), - Map.of("field", Map.of("username", "role-mapping-test-user")), - RoleDescriptor.Fields.METADATA.getPreferredName(), - metadata - ) - ) - ); - request.setJsonEntity(source.utf8ToString()); - assertOK(client().performRequest(request)); - } - - private void deleteNativeRoleMapping(String roleMappingName, boolean expectWarning) throws IOException { - final Request request = new Request("DELETE", "/_security/role_mapping/" + roleMappingName); - if (expectWarning) { - request.setOptions( - expectWarnings( - "A read-only role mapping with the same name [" - + roleMappingName - + "] has previously been defined in a configuration file. " - + "The native role mapping was deleted, but the read-only mapping will remain active " - + "and will be used to determine role assignments." - ) - ); - } - assertOK(client().performRequest(request)); - } - - private void assertAllRoleMappings(RestClient client, String... roleNames) throws IOException { - Request request = new Request("GET", "/_security/role_mapping"); - Response response = client.performRequest(request); - assertOK(response); - Map responseMap = responseAsMap(response); - - assertThat(responseMap.keySet(), containsInAnyOrder(roleNames)); - assertThat(responseMap.size(), is(roleNames.length)); - } -} diff --git a/x-pack/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/SecurityIndexRolesMetadataMigrationIT.java b/x-pack/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/SecurityIndexRolesMetadataMigrationIT.java index 6c34e68297aa..df8290327ee5 100644 --- a/x-pack/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/SecurityIndexRolesMetadataMigrationIT.java +++ b/x-pack/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/SecurityIndexRolesMetadataMigrationIT.java @@ -39,10 +39,6 @@ public class SecurityIndexRolesMetadataMigrationIT extends AbstractUpgradeTestCa if (CLUSTER_TYPE == ClusterType.OLD) { createRoleWithMetadata(oldTestRole, Map.of("meta", "test")); assertDocInSecurityIndex(oldTestRole); - if (canRolesBeMigrated() == false) { - assertNoMigration(adminClient()); - assertCannotQueryRolesByMetadata(client()); - } } else if (CLUSTER_TYPE == ClusterType.MIXED) { if (FIRST_MIXED_ROUND) { createRoleWithMetadata(mixed1TestRole, Map.of("meta", "test")); @@ -51,13 +47,8 @@ public class SecurityIndexRolesMetadataMigrationIT extends AbstractUpgradeTestCa createRoleWithMetadata(mixed2TestRole, Map.of("meta", "test")); assertDocInSecurityIndex(mixed2TestRole); } - if (canRolesBeMigrated() == false) { - assertNoMigration(adminClient()); - assertCannotQueryRolesByMetadata(client()); - } } else if (CLUSTER_TYPE == ClusterType.UPGRADED) { createRoleWithMetadata(upgradedTestRole, Map.of("meta", "test")); - assertTrue(canRolesBeMigrated()); waitForSecurityMigrationCompletion(adminClient(), 1); assertMigratedDocInSecurityIndex(oldTestRole, "meta", "test"); assertMigratedDocInSecurityIndex(mixed1TestRole, "meta", "test"); @@ -196,9 +187,4 @@ public class SecurityIndexRolesMetadataMigrationIT extends AbstractUpgradeTestCa assertThat(roles.get(i).get("name"), equalTo(roleNames[i])); } } - - private boolean canRolesBeMigrated() { - return clusterHasFeature("security.migration_framework") != false - && clusterHasFeature("security.roles_metadata_flattened") != false; - } }