Class RolloverRequest

All Implemented Interfaces:
IndicesRequest, AckedRequest, Writeable, org.elasticsearch.core.RefCounted, TaskAwareRequest, org.elasticsearch.xcontent.ToXContent, org.elasticsearch.xcontent.ToXContentObject

public class RolloverRequest extends AcknowledgedRequest<RolloverRequest> implements IndicesRequest, org.elasticsearch.xcontent.ToXContentObject
Request class to swap index under an alias or increment data stream generation upon satisfying conditions Note: there is a new class with the same name for the Java HLRC that uses a typeless format. Any changes done to this class should also go to that client class.
  • Constructor Details

  • Method Details

    • validate

      Specified by:
      validate in class ActionRequest
    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Overrides:
      writeTo in class AcknowledgedRequest<RolloverRequest>
      Throws:
      IOException
    • indices

      public String[] indices()
      Description copied from interface: IndicesRequest
      Returns the array of indices that the action relates to
      Specified by:
      indices in interface IndicesRequest
    • indicesOptions

      public IndicesOptions indicesOptions()
      Description copied from interface: IndicesRequest
      Returns the indices options used to resolve indices. They tell for instance whether a single index is accepted, whether an empty array will be converted to _all, and how wildcards will be expanded if needed.
      Specified by:
      indicesOptions in interface IndicesRequest
    • includeDataStreams

      public boolean includeDataStreams()
      Description copied from interface: IndicesRequest
      Determines whether the request should be applied to data streams. When false, none of the names or wildcard expressions in IndicesRequest.indices() should be applied to or expanded to any data streams. All layers involved in the request's fulfillment including security, name resolution, etc., should respect this flag.
      Specified by:
      includeDataStreams in interface IndicesRequest
    • setRolloverTarget

      public void setRolloverTarget(String rolloverTarget)
      Sets the rollover target to rollover to another index
    • setNewIndexName

      public void setNewIndexName(String newIndexName)
      Sets the alias to rollover to another index
    • dryRun

      public void dryRun(boolean dryRun)
      Sets if the rollover should not be executed when conditions are met
    • setWaitForActiveShards

      public void setWaitForActiveShards(ActiveShardCount waitForActiveShards)
      Sets the wait for active shards configuration for the rolled index that gets created.
    • addMaxIndexAgeCondition

      public void addMaxIndexAgeCondition(org.elasticsearch.core.TimeValue age)
      Adds condition to check if the index is at least age old
    • addMaxIndexDocsCondition

      public void addMaxIndexDocsCondition(long numDocs)
      Adds condition to check if the index has at least numDocs
    • addMaxIndexSizeCondition

      public void addMaxIndexSizeCondition(ByteSizeValue size)
      Adds a size-based condition to check if the index size is at least size.
    • addMaxPrimaryShardSizeCondition

      public void addMaxPrimaryShardSizeCondition(ByteSizeValue size)
      Adds a size-based condition to check if the size of the largest primary shard is at least size.
    • isDryRun

      public boolean isDryRun()
    • getConditions

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

      public String getRolloverTarget()
    • getNewIndexName

      public String getNewIndexName()
    • getCreateIndexRequest

      public CreateIndexRequest getCreateIndexRequest()
      Returns the inner CreateIndexRequest. Allows to configure mappings, settings and aliases for the new index.
    • toXContent

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

      public void fromXContent(boolean isTypeIncluded, org.elasticsearch.xcontent.XContentParser parser) throws IOException
      Throws:
      IOException