All Implemented Interfaces:
IndicesRequest, AckedRequest, Writeable, RefCounted, TaskAwareRequest

public class RolloverRequest extends AcknowledgedRequest<RolloverRequest> implements IndicesRequest
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

      Overrides:
      validate in class AcknowledgedRequest<RolloverRequest>
    • 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.
    • setConditions

      public void setConditions(RolloverConditions conditions)
      Sets the conditions that need to be met for the index to roll over
    • lazy

      public void lazy(boolean lazy)
      Sets if an unconditional rollover should wait for a document to come before it gets executed
    • isDryRun

      public boolean isDryRun()
    • getConditions

      public RolloverConditions getConditions()
    • getConditionValues

      public Collection<Condition<?>> getConditionValues()
    • getRolloverTarget

      public String getRolloverTarget()
    • getNewIndexName

      public String getNewIndexName()
    • isLazy

      public boolean isLazy()
    • 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
    • getCreateIndexRequest

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

      public void fromXContent(boolean isTypeIncluded, XContentParser parser) throws IOException
      Throws:
      IOException
    • createTask

      public Task createTask(long id, String type, String action, TaskId parentTaskId, Map<String,String> headers)
      Description copied from interface: TaskAwareRequest
      Returns the task object that should be used to keep track of the processing of the request.
      Specified by:
      createTask in interface TaskAwareRequest
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object