Class ResizeRequest

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

public class ResizeRequest extends AcknowledgedRequest<ResizeRequest> implements IndicesRequest, ToXContentObject
Request class to shrink an index into a single shard
  • Field Details

  • Constructor Details

  • Method Details

    • validate

      Specified by:
      validate in class ActionRequest
    • setSourceIndex

      public void setSourceIndex(String index)
    • 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<ResizeRequest>
      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
    • setTargetIndex

      public void setTargetIndex(CreateIndexRequest targetIndexRequest)
    • getTargetIndexRequest

      public CreateIndexRequest getTargetIndexRequest()
      Returns the CreateIndexRequest for the shrink index
    • getSourceIndex

      public String getSourceIndex()
      Returns the source index name
    • setWaitForActiveShards

      public void setWaitForActiveShards(ActiveShardCount waitForActiveShards)
      Sets the number of shard copies that should be active for creation of the new shrunken index to return. Defaults to ActiveShardCount.DEFAULT, which will wait for one shard copy (the primary) to become active. Set this value to ActiveShardCount.ALL to wait for all shards (primary and all replicas) to be active before returning. Otherwise, use ActiveShardCount.from(int) to set this value to any non-negative integer, up to the number of copies per shard (number of replicas + 1), to wait for the desired amount of shard copies to become active before returning. Index creation will only wait up until the timeout value for the number of shard copies to be active before returning. Check ShardsAcknowledgedResponse.isShardsAcknowledged() to determine if the requisite shard copies were all started before returning or timing out.
      Parameters:
      waitForActiveShards - number of active shard copies to wait on
    • setWaitForActiveShards

      public void setWaitForActiveShards(int waitForActiveShards)
      A shortcut for setWaitForActiveShards(ActiveShardCount) where the numerical shard count is passed in, instead of having to first call ActiveShardCount.from(int) to get the ActiveShardCount.
    • setResizeType

      public void setResizeType(ResizeType type)
      The type of the resize operation
    • getResizeType

      public ResizeType getResizeType()
      Returns the type of the resize operation
    • setCopySettings

      public void setCopySettings(Boolean copySettings)
    • getCopySettings

      public Boolean getCopySettings()
    • setMaxPrimaryShardSize

      public void setMaxPrimaryShardSize(ByteSizeValue maxPrimaryShardSize)
      Sets the max primary shard size of the target index. It's used to calculate an optimum shards number of the target index according to storage of the source index, each shard's storage of the target index will not be greater than this parameter, while the shards number of the target index still be a factor of the source index's shards number.
      Parameters:
      maxPrimaryShardSize - the max primary shard size of the target index
    • getMaxPrimaryShardSize

      public ByteSizeValue getMaxPrimaryShardSize()
      Returns the max primary shard size of the target index
    • toXContent

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

      public void fromXContent(XContentParser parser) throws IOException
      Throws:
      IOException
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object