diff --git a/modules/reindex-management/src/main/java/org/elasticsearch/reindex/management/ReindexManagementFeatures.java b/modules/reindex-management/src/main/java/org/elasticsearch/reindex/management/ReindexManagementFeatures.java index a1c45abf5c3dc..10870f1568d85 100644 --- a/modules/reindex-management/src/main/java/org/elasticsearch/reindex/management/ReindexManagementFeatures.java +++ b/modules/reindex-management/src/main/java/org/elasticsearch/reindex/management/ReindexManagementFeatures.java @@ -13,6 +13,7 @@ import org.elasticsearch.features.NodeFeature; import org.elasticsearch.reindex.ReindexPlugin; +import java.util.HashSet; import java.util.Set; public class ReindexManagementFeatures implements FeatureSpecification { @@ -21,9 +22,17 @@ public class ReindexManagementFeatures implements FeatureSpecification { @Override public Set getFeatures() { - // TODO: Before we release this functionality by removing the REINDEX_RESILIENCE_ENABLED checks, we should see whether we can + final Set features = new HashSet<>(); + // TODO: Before we release any functionality behind FeatureFlags, we should see whether we can // consolidate the node features. These are a constrained resource, so we should combine the features for anything that is being // released at the same time while we still can. - return ReindexPlugin.REINDEX_RESILIENCE_ENABLED ? Set.of(NEW_ENDPOINTS, ReindexPlugin.RELOCATE_ON_SHUTDOWN_NODE_FEATURE) : Set.of(); + if (ReindexPlugin.REINDEX_RESILIENCE_ENABLED) { + features.add(NEW_ENDPOINTS); + features.add(ReindexPlugin.RELOCATE_ON_SHUTDOWN_NODE_FEATURE); + } + if (ReindexPlugin.REINDEX_PIT_SEARCH_ENABLED) { + features.add(ReindexPlugin.REINDEX_PIT_SEARCH_FEATURE); + } + return Set.copyOf(features); } } diff --git a/modules/reindex/src/main/java/org/elasticsearch/reindex/ReindexPlugin.java b/modules/reindex/src/main/java/org/elasticsearch/reindex/ReindexPlugin.java index 46125c456c3f5..6deb6a2940b40 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/reindex/ReindexPlugin.java +++ b/modules/reindex/src/main/java/org/elasticsearch/reindex/ReindexPlugin.java @@ -49,17 +49,23 @@ public class ReindexPlugin extends Plugin implements ActionPlugin, ExtensiblePlu public static final ActionType RETHROTTLE_ACTION = new ActionType<>("cluster:admin/reindex/rethrottle"); - // N.B. We declare this in the reindex module, so that we can check whether the feature is available on the cluster here - but we - // register it via a FeatureSpecification in the reindex-management module, to work around build problems caused by doing it here. + // N.B. We declare these in the reindex module, so that we can check whether the features are available on the cluster here - but we + // register them via a FeatureSpecification in the reindex-management module, to work around build problems caused by doing it here. // (The enrich plugin depends on this module, and registering features leads to either duplicate feature or JAR hell errors.) // (This approach means that the functionality requires both reindex and reindex-management modules to be present and enabled.) public static final NodeFeature RELOCATE_ON_SHUTDOWN_NODE_FEATURE = new NodeFeature("reindex_relocate_on_shutdown"); + public static final NodeFeature REINDEX_PIT_SEARCH_FEATURE = new NodeFeature("reindex_pit_search"); /** * Whether the feature flag to guard the work to make reindex more resilient while it is under development. */ public static final boolean REINDEX_RESILIENCE_ENABLED = new FeatureFlag("reindex_resilience").isEnabled(); + /** + * Guards the development work to change reindexing to use point in time (PIT) searching + */ + public static final boolean REINDEX_PIT_SEARCH_ENABLED = new FeatureFlag("reindex_pit_search").isEnabled(); + @Override public List getActions() { return Arrays.asList(