diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/AllocationRoutedStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/AllocationRoutedStep.java index 3cbb4bb3890b9..bd0c619d8f3cc 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/AllocationRoutedStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/AllocationRoutedStep.java @@ -32,6 +32,9 @@ import java.util.Collections; import java.util.Objects; +/** + * Checks whether all shards have been correctly routed in response to an update to the allocation rules for an index. + */ public class AllocationRoutedStep extends ClusterStateWaitStep { public static final String NAME = "check-allocation"; diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/AsyncActionStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/AsyncActionStep.java index 4e35ef60a09d6..700c817164503 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/AsyncActionStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/AsyncActionStep.java @@ -9,6 +9,9 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetaData; +/** + * Performs an action which must be performed asynchronously because it may take time to complete. + */ public abstract class AsyncActionStep extends Step { private Client client; diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/AsyncWaitStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/AsyncWaitStep.java index f6c968cfae41a..d67a20b758018 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/AsyncWaitStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/AsyncWaitStep.java @@ -9,6 +9,12 @@ import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.xcontent.ToXContentObject; +/** + * A step which will be called periodically, waiting for some condition to become true. + * Called asynchronously, as the condition may take time to check. + * + * If checking something based on the current cluster state which does not take time to check, use {@link ClusterStateWaitStep}. + */ public abstract class AsyncWaitStep extends Step { private Client client; diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ClusterStateActionStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ClusterStateActionStep.java index ae64de497886a..83e0e015aa933 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ClusterStateActionStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ClusterStateActionStep.java @@ -8,6 +8,9 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.index.Index; +/** + * Updates the cluster state, similar to {@link org.elasticsearch.cluster.ClusterStateUpdateTask}. + */ public abstract class ClusterStateActionStep extends Step { public ClusterStateActionStep(StepKey key, StepKey nextStepKey) { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ClusterStateWaitStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ClusterStateWaitStep.java index 0468f75490d9e..d8fb5d651852f 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ClusterStateWaitStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ClusterStateWaitStep.java @@ -9,6 +9,11 @@ import org.elasticsearch.common.xcontent.ToXContentObject; import org.elasticsearch.index.Index; +/** + * Checks whether a condition has been met based on the cluster state. + * + * If checking a condition not based on the cluster state, or which may take time to evaluate, use {@link AsyncWaitStep}. + */ public abstract class ClusterStateWaitStep extends Step { public ClusterStateWaitStep(StepKey key, StepKey nextStepKey) { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/DeleteStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/DeleteStep.java index b5ae441388419..f34da641a0cb4 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/DeleteStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/DeleteStep.java @@ -11,6 +11,9 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetaData; +/** + * Deletes a single index. + */ public class DeleteStep extends AsyncActionStep { public static final String NAME = "delete"; diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ErrorStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ErrorStep.java index 50ad0155dff29..2a22253166580 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ErrorStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ErrorStep.java @@ -5,6 +5,9 @@ */ package org.elasticsearch.xpack.core.indexlifecycle; +/** + * Signals that an error was encountered during the execution of a policy on an index. + */ public class ErrorStep extends Step { public static final String NAME = "ERROR"; diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ForceMergeStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ForceMergeStep.java index 776043babf0fc..799959ce69f61 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ForceMergeStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ForceMergeStep.java @@ -13,6 +13,9 @@ import java.util.Objects; +/** + * Invokes a force merge on a single index. + */ public class ForceMergeStep extends AsyncActionStep { public static final String NAME = "forcemerge"; private final int maxNumSegments; diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/InitializePolicyContextStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/InitializePolicyContextStep.java index c9046cb5eb7ec..da0ae37eff7bc 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/InitializePolicyContextStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/InitializePolicyContextStep.java @@ -14,6 +14,9 @@ import static org.elasticsearch.xpack.core.indexlifecycle.LifecycleExecutionState.ILM_CUSTOM_METADATA_KEY; +/** + * Initializes the {@link LifecycleExecutionState} for an index. This should be the first Step called on an index. + */ public final class InitializePolicyContextStep extends ClusterStateActionStep { public static final String INITIALIZATION_PHASE = "new"; public static final StepKey KEY = new StepKey(INITIALIZATION_PHASE, "init", "init"); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/SegmentCountStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/SegmentCountStep.java index 0d706dca10445..d37d8c0a18805 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/SegmentCountStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/SegmentCountStep.java @@ -21,7 +21,7 @@ import java.util.stream.StreamSupport; /** - * This {@link Step} evaluates whether force_merge was successful + * This {@link Step} evaluates whether force_merge was successful by checking the segment count. */ public class SegmentCountStep extends AsyncWaitStep { public static final String NAME = "segment-count"; diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/SetSingleNodeAllocateStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/SetSingleNodeAllocateStep.java index 0caa217841769..973dd7f0ba08d 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/SetSingleNodeAllocateStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/SetSingleNodeAllocateStep.java @@ -27,6 +27,10 @@ import java.util.List; import java.util.Optional; +/** + * Allocates all shards in a single index to one node. + * For example, as preparation for shrinking that index. + */ public class SetSingleNodeAllocateStep extends AsyncActionStep { public static final String NAME = "set-single-node-allocation"; diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ShrinkSetAliasStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ShrinkSetAliasStep.java index b9e0e00eeb600..52fc955a2327a 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ShrinkSetAliasStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ShrinkSetAliasStep.java @@ -13,6 +13,10 @@ import java.util.Objects; +/** + * Following shrinking an index and deleting the original index, this step creates an alias with the same name as the original index which + * points to the new shrunken index to allow clients to continue to use the original index name without being aware that it has shrunk. + */ public class ShrinkSetAliasStep extends AsyncActionStep { public static final String NAME = "aliases"; private String shrunkIndexPrefix; diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ShrinkStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ShrinkStep.java index 8c7adcb62ff4e..4847cd07a20ad 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ShrinkStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ShrinkStep.java @@ -15,6 +15,9 @@ import java.util.Objects; +/** + * Shrinks an index, using a prefix prepended to the original index name for the name of the shrunken index. + */ public class ShrinkStep extends AsyncActionStep { public static final String NAME = "shrink"; diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ShrunkShardsAllocatedStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ShrunkShardsAllocatedStep.java index b64ebf5e46b5a..105c7eb55f47b 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ShrunkShardsAllocatedStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ShrunkShardsAllocatedStep.java @@ -17,6 +17,9 @@ import java.io.IOException; import java.util.Objects; +/** + * Checks whether all shards in a shrunken index have been successfully allocated. + */ public class ShrunkShardsAllocatedStep extends ClusterStateWaitStep { public static final String NAME = "shrunk-shards-allocated"; private String shrunkIndexPrefix; diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ShrunkenIndexCheckStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ShrunkenIndexCheckStep.java index 28e219cd4e542..6d48bd6925fc1 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ShrunkenIndexCheckStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ShrunkenIndexCheckStep.java @@ -19,6 +19,10 @@ import java.io.IOException; import java.util.Objects; +/** + * Verifies that an index was created through a shrink operation, rather than created some other way. + * Also checks the name of the index to ensure it aligns with what is expected from an index shrunken via a previous step. + */ public class ShrunkenIndexCheckStep extends ClusterStateWaitStep { public static final String NAME = "is-shrunken-index"; private static final Logger logger = LogManager.getLogger(InitializePolicyContextStep.class); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/Step.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/Step.java index 7152b093e62ef..5f24ab29d0284 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/Step.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/Step.java @@ -19,7 +19,7 @@ import java.util.Objects; /** - * A {@link LifecycleAction} which deletes the index. + * Represents one part of the execution of a {@link LifecycleAction}. */ public abstract class Step { private final StepKey key; diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/TerminalPolicyStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/TerminalPolicyStep.java index 4ba1b4fd83c60..25e0cc7e7dbbb 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/TerminalPolicyStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/TerminalPolicyStep.java @@ -5,6 +5,9 @@ */ package org.elasticsearch.xpack.core.indexlifecycle; +/** + * Signals that the policy for an index has been fully executed. + */ public class TerminalPolicyStep extends Step { public static final String COMPLETED_PHASE = "completed"; public static final StepKey KEY = new StepKey(COMPLETED_PHASE, "completed", "completed"); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/UpdateRolloverLifecycleDateStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/UpdateRolloverLifecycleDateStep.java index e897578c87e29..6f5160fa13a20 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/UpdateRolloverLifecycleDateStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/UpdateRolloverLifecycleDateStep.java @@ -14,6 +14,10 @@ import static org.elasticsearch.xpack.core.indexlifecycle.LifecycleExecutionState.ILM_CUSTOM_METADATA_KEY; +/** + * Copies the lifecycle reference date to a new index created by rolling over an alias. + * Used so that the "age" of an index doesn't get reset on rollover. + */ public class UpdateRolloverLifecycleDateStep extends ClusterStateActionStep { public static final String NAME = "update-rollover-lifecycle-date"; diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/UpdateSettingsStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/UpdateSettingsStep.java index 5602f6aa3f499..c66c1427d07d4 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/UpdateSettingsStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/UpdateSettingsStep.java @@ -14,6 +14,9 @@ import java.util.Objects; +/** + * Updates the settings for an index. + */ public class UpdateSettingsStep extends AsyncActionStep { public static final String NAME = "update-settings";