Remove assumed features in xpack for 9.0 (#120049)

Remove all assumed features defined in xpack added before 8.18
This commit is contained in:
Simon Cooper 2025-01-15 11:06:30 +00:00 committed by GitHub
parent 03424aa5bc
commit ca4ea21fb3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
58 changed files with 59 additions and 636 deletions

View file

@ -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 } }

View file

@ -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

View file

@ -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

View file

@ -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<NodeFeature> getFeatures() {
return Set.of(
QUERY_RULES_TEST_API,
QueryRuleRetrieverBuilder.QUERY_RULE_RETRIEVERS_SUPPORTED,
ListQueryRulesetsAction.QUERY_RULE_LIST_TYPES
);
return Set.of();
}
}

View file

@ -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<ListQueryRulesetsAction.Response> 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 {

View file

@ -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<TestQueryRulesetAction.Response> TYPE = new ActionType<>("cluster:admin/xpack/query_rules/test");

View file

@ -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<QueryRuleRetrieverBuilder> {
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<Qu
}
public static QueryRuleRetrieverBuilder fromXContent(XContentParser parser, RetrieverParserContext context) throws IOException {
if (context.clusterSupportsFeature(QUERY_RULE_RETRIEVERS_SUPPORTED) == false) {
throw new ParsingException(parser.getTokenLocation(), "unknown retriever [" + NAME + "]");
}
if (EnterpriseSearch.QUERY_RULES_RETRIEVER_FEATURE.check(XPackPlugin.getSharedLicenseState()) == false) {
throw LicenseUtils.newComplianceException("Query Rules");
}

View file

@ -9,6 +9,7 @@ package org.elasticsearch.xpack.application.rules.retriever;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.core.Predicates;
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.retriever.RetrieverBuilder;
@ -53,7 +54,7 @@ public class QueryRuleRetrieverBuilderTests extends AbstractXContentTestCase<Que
protected QueryRuleRetrieverBuilder doParseInstance(XContentParser parser) throws IOException {
return (QueryRuleRetrieverBuilder) RetrieverBuilder.parseTopLevelRetrieverBuilder(
parser,
new RetrieverParserContext(new SearchUsage(), nf -> nf == QueryRuleRetrieverBuilder.QUERY_RULE_RETRIEVERS_SUPPORTED)
new RetrieverParserContext(new SearchUsage(), Predicates.never())
);
}