java.lang.Object
org.elasticsearch.xpack.core.ilm.LifecyclePolicyUtils
A utility class used for index lifecycle policies
-
Method Summary
Modifier and TypeMethodDescriptionstatic ItemUsagecalculateUsage(IndexNameExpressionResolver indexNameExpressionResolver, ClusterState state, String policyName) Given a cluster state and ILM policy, calculate theItemUsageof the policy (what indices, data streams, and templates use the policy)static LifecyclePolicyloadPolicy(String name, String resource, Map<String, String> variables, org.elasticsearch.xcontent.NamedXContentRegistry xContentRegistry) Loads a built-in index lifecycle policy and returns its source.static LifecyclePolicyparsePolicy(String rawPolicy, String name, org.elasticsearch.xcontent.NamedXContentRegistry xContentRegistry, org.elasticsearch.xcontent.XContentType contentType) Parses lifecycle policy based on the provided content type without doing any variable substitution.static StringreplaceVariable(String input, String variable, String value) Replaces all occurrences of given variable with the value
-
Method Details
-
loadPolicy
public static LifecyclePolicy loadPolicy(String name, String resource, Map<String, String> variables, org.elasticsearch.xcontent.NamedXContentRegistry xContentRegistry) Loads a built-in index lifecycle policy and returns its source. -
parsePolicy
public static LifecyclePolicy parsePolicy(String rawPolicy, String name, org.elasticsearch.xcontent.NamedXContentRegistry xContentRegistry, org.elasticsearch.xcontent.XContentType contentType) throws IOException Parses lifecycle policy based on the provided content type without doing any variable substitution. It is caller's responsibility to do any variable substitution if required.- Throws:
IOException
-
replaceVariable
Replaces all occurrences of given variable with the value -
calculateUsage
public static ItemUsage calculateUsage(IndexNameExpressionResolver indexNameExpressionResolver, ClusterState state, String policyName) Given a cluster state and ILM policy, calculate theItemUsageof the policy (what indices, data streams, and templates use the policy)
-