|
@@ -20,7 +20,6 @@ import org.elasticsearch.common.settings.IndexScopedSettings;
|
|
|
import org.elasticsearch.common.settings.Setting;
|
|
|
import org.elasticsearch.common.settings.Settings;
|
|
|
import org.elasticsearch.common.settings.SettingsFilter;
|
|
|
-import org.elasticsearch.common.util.FeatureFlag;
|
|
|
import org.elasticsearch.env.Environment;
|
|
|
import org.elasticsearch.env.NodeEnvironment;
|
|
|
import org.elasticsearch.indices.IndicesService;
|
|
@@ -93,7 +92,6 @@ import org.elasticsearch.xpack.core.XPackSettings;
|
|
|
import org.elasticsearch.xpack.core.action.XPackInfoFeatureAction;
|
|
|
import org.elasticsearch.xpack.core.action.XPackUsageFeatureAction;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.Collection;
|
|
|
import java.util.Collections;
|
|
@@ -118,8 +116,6 @@ public class EnterpriseSearch extends Plugin implements ActionPlugin, SystemInde
|
|
|
|
|
|
private final boolean enabled;
|
|
|
|
|
|
- private static final FeatureFlag QUERY_RULES_FEATURE_FLAG = new FeatureFlag("query_rules");
|
|
|
-
|
|
|
public EnterpriseSearch(Settings settings) {
|
|
|
this.enabled = XPackSettings.ENTERPRISE_SEARCH_ENABLED.get(settings);
|
|
|
}
|
|
@@ -136,31 +132,29 @@ public class EnterpriseSearch extends Plugin implements ActionPlugin, SystemInde
|
|
|
return List.of(usageAction, infoAction);
|
|
|
}
|
|
|
|
|
|
- final List<ActionHandler<? extends ActionRequest, ? extends ActionResponse>> actionHandlers = new ArrayList<>(
|
|
|
- List.of(
|
|
|
- new ActionHandler<>(PutAnalyticsCollectionAction.INSTANCE, TransportPutAnalyticsCollectionAction.class),
|
|
|
- new ActionHandler<>(GetAnalyticsCollectionAction.INSTANCE, TransportGetAnalyticsCollectionAction.class),
|
|
|
- new ActionHandler<>(DeleteAnalyticsCollectionAction.INSTANCE, TransportDeleteAnalyticsCollectionAction.class),
|
|
|
- new ActionHandler<>(PostAnalyticsEventAction.INSTANCE, TransportPostAnalyticsEventAction.class),
|
|
|
- new ActionHandler<>(DeleteSearchApplicationAction.INSTANCE, TransportDeleteSearchApplicationAction.class),
|
|
|
- new ActionHandler<>(GetSearchApplicationAction.INSTANCE, TransportGetSearchApplicationAction.class),
|
|
|
- new ActionHandler<>(ListSearchApplicationAction.INSTANCE, TransportListSearchApplicationAction.class),
|
|
|
- new ActionHandler<>(PutSearchApplicationAction.INSTANCE, TransportPutSearchApplicationAction.class),
|
|
|
- new ActionHandler<>(QuerySearchApplicationAction.INSTANCE, TransportQuerySearchApplicationAction.class),
|
|
|
- new ActionHandler<>(RenderSearchApplicationQueryAction.INSTANCE, TransportRenderSearchApplicationQueryAction.class),
|
|
|
- usageAction,
|
|
|
- infoAction
|
|
|
- )
|
|
|
+ return List.of(
|
|
|
+ // Behavioral Analytics
|
|
|
+ new ActionHandler<>(PutAnalyticsCollectionAction.INSTANCE, TransportPutAnalyticsCollectionAction.class),
|
|
|
+ new ActionHandler<>(GetAnalyticsCollectionAction.INSTANCE, TransportGetAnalyticsCollectionAction.class),
|
|
|
+ new ActionHandler<>(DeleteAnalyticsCollectionAction.INSTANCE, TransportDeleteAnalyticsCollectionAction.class),
|
|
|
+ new ActionHandler<>(PostAnalyticsEventAction.INSTANCE, TransportPostAnalyticsEventAction.class),
|
|
|
+
|
|
|
+ // Search Applications
|
|
|
+ new ActionHandler<>(DeleteSearchApplicationAction.INSTANCE, TransportDeleteSearchApplicationAction.class),
|
|
|
+ new ActionHandler<>(GetSearchApplicationAction.INSTANCE, TransportGetSearchApplicationAction.class),
|
|
|
+ new ActionHandler<>(ListSearchApplicationAction.INSTANCE, TransportListSearchApplicationAction.class),
|
|
|
+ new ActionHandler<>(PutSearchApplicationAction.INSTANCE, TransportPutSearchApplicationAction.class),
|
|
|
+ new ActionHandler<>(QuerySearchApplicationAction.INSTANCE, TransportQuerySearchApplicationAction.class),
|
|
|
+ new ActionHandler<>(RenderSearchApplicationQueryAction.INSTANCE, TransportRenderSearchApplicationQueryAction.class),
|
|
|
+
|
|
|
+ // Query rules
|
|
|
+ new ActionHandler<>(DeleteQueryRulesetAction.INSTANCE, TransportDeleteQueryRulesetAction.class),
|
|
|
+ new ActionHandler<>(GetQueryRulesetAction.INSTANCE, TransportGetQueryRulesetAction.class),
|
|
|
+ new ActionHandler<>(ListQueryRulesetsAction.INSTANCE, TransportListQueryRulesetsAction.class),
|
|
|
+ new ActionHandler<>(PutQueryRulesetAction.INSTANCE, TransportPutQueryRulesetAction.class),
|
|
|
+ usageAction,
|
|
|
+ infoAction
|
|
|
);
|
|
|
-
|
|
|
- if (QUERY_RULES_FEATURE_FLAG.isEnabled()) {
|
|
|
- actionHandlers.add(new ActionHandler<>(DeleteQueryRulesetAction.INSTANCE, TransportDeleteQueryRulesetAction.class));
|
|
|
- actionHandlers.add(new ActionHandler<>(GetQueryRulesetAction.INSTANCE, TransportGetQueryRulesetAction.class));
|
|
|
- actionHandlers.add(new ActionHandler<>(ListQueryRulesetsAction.INSTANCE, TransportListQueryRulesetsAction.class));
|
|
|
- actionHandlers.add(new ActionHandler<>(PutQueryRulesetAction.INSTANCE, TransportPutQueryRulesetAction.class));
|
|
|
- }
|
|
|
-
|
|
|
- return Collections.unmodifiableList(actionHandlers);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -178,29 +172,27 @@ public class EnterpriseSearch extends Plugin implements ActionPlugin, SystemInde
|
|
|
return Collections.emptyList();
|
|
|
}
|
|
|
|
|
|
- final List<RestHandler> restHandlers = new ArrayList<>(
|
|
|
- List.of(
|
|
|
- new RestPutAnalyticsCollectionAction(getLicenseState()),
|
|
|
- new RestGetAnalyticsCollectionAction(getLicenseState()),
|
|
|
- new RestDeleteAnalyticsCollectionAction(getLicenseState()),
|
|
|
- new RestPostAnalyticsEventAction(getLicenseState()),
|
|
|
- new RestDeleteSearchApplicationAction(getLicenseState()),
|
|
|
- new RestGetSearchApplicationAction(getLicenseState()),
|
|
|
- new RestListSearchApplicationAction(getLicenseState()),
|
|
|
- new RestPutSearchApplicationAction(getLicenseState()),
|
|
|
- new RestQuerySearchApplicationAction(getLicenseState()),
|
|
|
- new RestRenderSearchApplicationQueryAction(getLicenseState())
|
|
|
- )
|
|
|
+ return List.of(
|
|
|
+ // Behavioral Analytics
|
|
|
+ new RestPutAnalyticsCollectionAction(getLicenseState()),
|
|
|
+ new RestGetAnalyticsCollectionAction(getLicenseState()),
|
|
|
+ new RestDeleteAnalyticsCollectionAction(getLicenseState()),
|
|
|
+ new RestPostAnalyticsEventAction(getLicenseState()),
|
|
|
+
|
|
|
+ // Search Applications
|
|
|
+ new RestDeleteSearchApplicationAction(getLicenseState()),
|
|
|
+ new RestGetSearchApplicationAction(getLicenseState()),
|
|
|
+ new RestListSearchApplicationAction(getLicenseState()),
|
|
|
+ new RestPutSearchApplicationAction(getLicenseState()),
|
|
|
+ new RestQuerySearchApplicationAction(getLicenseState()),
|
|
|
+ new RestRenderSearchApplicationQueryAction(getLicenseState()),
|
|
|
+
|
|
|
+ // Query rules
|
|
|
+ new RestDeleteQueryRulesetAction(getLicenseState()),
|
|
|
+ new RestGetQueryRulesetAction(getLicenseState()),
|
|
|
+ new RestListQueryRulesetsAction(getLicenseState()),
|
|
|
+ new RestPutQueryRulesetAction(getLicenseState())
|
|
|
);
|
|
|
-
|
|
|
- if (QUERY_RULES_FEATURE_FLAG.isEnabled()) {
|
|
|
- restHandlers.add(new RestDeleteQueryRulesetAction(getLicenseState()));
|
|
|
- restHandlers.add(new RestGetQueryRulesetAction(getLicenseState()));
|
|
|
- restHandlers.add(new RestListQueryRulesetsAction(getLicenseState()));
|
|
|
- restHandlers.add(new RestPutQueryRulesetAction(getLicenseState()));
|
|
|
- }
|
|
|
-
|
|
|
- return Collections.unmodifiableList(restHandlers);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -238,14 +230,7 @@ public class EnterpriseSearch extends Plugin implements ActionPlugin, SystemInde
|
|
|
|
|
|
@Override
|
|
|
public Collection<SystemIndexDescriptor> getSystemIndexDescriptors(Settings settings) {
|
|
|
- if (QUERY_RULES_FEATURE_FLAG.isEnabled()) {
|
|
|
- return Arrays.asList(
|
|
|
- SearchApplicationIndexService.getSystemIndexDescriptor(),
|
|
|
- QueryRulesIndexService.getSystemIndexDescriptor()
|
|
|
- );
|
|
|
- } else {
|
|
|
- return Collections.singletonList(SearchApplicationIndexService.getSystemIndexDescriptor());
|
|
|
- }
|
|
|
+ return Arrays.asList(SearchApplicationIndexService.getSystemIndexDescriptor(), QueryRulesIndexService.getSystemIndexDescriptor());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -271,10 +256,6 @@ public class EnterpriseSearch extends Plugin implements ActionPlugin, SystemInde
|
|
|
|
|
|
@Override
|
|
|
public List<QuerySpec<?>> getQueries() {
|
|
|
- if (QUERY_RULES_FEATURE_FLAG.isEnabled()) {
|
|
|
- return singletonList(new QuerySpec<>(RuleQueryBuilder.NAME, RuleQueryBuilder::new, RuleQueryBuilder::fromXContent));
|
|
|
- } else {
|
|
|
- return Collections.emptyList();
|
|
|
- }
|
|
|
+ return singletonList(new QuerySpec<>(RuleQueryBuilder.NAME, RuleQueryBuilder::new, RuleQueryBuilder::fromXContent));
|
|
|
}
|
|
|
}
|