java.lang.Object
org.elasticsearch.action.admin.indices.rollover.RolloverConditions
All Implemented Interfaces:
Writeable, ToXContent, ToXContentObject

public class RolloverConditions extends Object implements Writeable, ToXContentObject
Contains the conditions that determine if an index can be rolled over or not. It is used by the RolloverRequest, the Index Lifecycle Management and the Data Stream Lifecycle.
  • Field Details

    • PARSER

      public static final ObjectParser<RolloverConditions.Builder,Void> PARSER
    • MAX_AGE_FIELD

      public static final ParseField MAX_AGE_FIELD
    • MAX_DOCS_FIELD

      public static final ParseField MAX_DOCS_FIELD
    • MAX_SIZE_FIELD

      public static final ParseField MAX_SIZE_FIELD
    • MAX_PRIMARY_SHARD_SIZE_FIELD

      public static final ParseField MAX_PRIMARY_SHARD_SIZE_FIELD
    • MAX_PRIMARY_SHARD_DOCS_FIELD

      public static final ParseField MAX_PRIMARY_SHARD_DOCS_FIELD
    • MIN_AGE_FIELD

      public static final ParseField MIN_AGE_FIELD
    • MIN_DOCS_FIELD

      public static final ParseField MIN_DOCS_FIELD
    • MIN_SIZE_FIELD

      public static final ParseField MIN_SIZE_FIELD
    • MIN_PRIMARY_SHARD_SIZE_FIELD

      public static final ParseField MIN_PRIMARY_SHARD_SIZE_FIELD
    • MIN_PRIMARY_SHARD_DOCS_FIELD

      public static final ParseField MIN_PRIMARY_SHARD_DOCS_FIELD
  • Constructor Details

  • Method Details

    • hasMaxConditions

      public boolean hasMaxConditions()
      Returns true if there is at least one condition of type MAX
    • hasMinConditions

      public boolean hasMinConditions()
      Returns true if there is at least one condition of type MIN
    • hasConditions

      public boolean hasConditions()
      Returns true if there is at least one condition of any type
    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • getMaxSize

      @Nullable public ByteSizeValue getMaxSize()
      Returns the size an index can reach before rollover is triggered, if defined, or null otherwise
    • getMaxPrimaryShardSize

      @Nullable public ByteSizeValue getMaxPrimaryShardSize()
      Returns the size a primary shard can reach before rollover is triggered, if defined, or null otherwise
    • getMaxAge

      @Nullable public TimeValue getMaxAge()
      Returns the age an index can reach before rollover is triggered, if defined, or null otherwise
    • getMaxDocs

      @Nullable public Long getMaxDocs()
      Returns the max count of documents an index can reach before rollover is triggered, if it is defined, or null otherwise
    • getMaxPrimaryShardDocs

      @Nullable public Long getMaxPrimaryShardDocs()
      Returns the max count of documents a primary shard can reach before rollover is triggered, if it is defined, or null otherwise
    • getMinSize

      @Nullable public ByteSizeValue getMinSize()
      Returns the minimum size an index is required to have before rollover is allowed, if it is defined, or null otherwise
    • getMinPrimaryShardSize

      @Nullable public ByteSizeValue getMinPrimaryShardSize()
      Returns the minimum size a primary shard is required to have before rollover is allowed, if it is defined, or null otherwise
    • getMinAge

      @Nullable public TimeValue getMinAge()
      Returns the minimum age an index is required to have before rollover is allowed, if it is defined, or null otherwise
    • getMinDocs

      @Nullable public Long getMinDocs()
      Returns the minimum document count an index is required to have before rollover is allowed, if it is defined, or null otherwise
    • getMinPrimaryShardDocs

      @Nullable public Long getMinPrimaryShardDocs()
      Returns the minimum document count a primary shard is required to have before rollover is allowed, if it is defined, or null otherwise
    • getConditions

      public Map<String,Condition<?>> getConditions()
    • areConditionsMet

      public boolean areConditionsMet(Map<String,Boolean> conditionResults)
      Given the results of evaluating each individual condition, determine whether the rollover request should proceed -- that is, whether the conditions are met. If there are no conditions at all, then the request is unconditional (i.e. a command), and the conditions are met. If the request has conditions, then all min_* conditions and at least one max_* condition must have a true result.
      Parameters:
      conditionResults - a map of individual conditions and their associated evaluation results
      Returns:
      where the conditions for rollover are satisfied or not
    • fromXContent

      public static RolloverConditions fromXContent(XContentParser parser) throws IOException
      Throws:
      IOException
    • toXContent

      public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface ToXContent
      Throws:
      IOException
    • toXContentFragment

      public XContentBuilder toXContentFragment(XContentBuilder builder, ToXContent.Params params) throws IOException
      This method adds the conditions as fields in an already existing object.
      Throws:
      IOException
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • newBuilder

      public static RolloverConditions.Builder newBuilder(RolloverConditions conditions)
    • newBuilder

      public static RolloverConditions.Builder newBuilder()