Class ResizeRequest

java.lang.Object
org.elasticsearch.client.TimedRequest
org.elasticsearch.client.indices.ResizeRequest
All Implemented Interfaces:
Validatable, org.elasticsearch.xcontent.ToXContent, org.elasticsearch.xcontent.ToXContentObject

public class ResizeRequest extends TimedRequest implements Validatable, org.elasticsearch.xcontent.ToXContentObject
Request class to resize an index
  • Constructor Details

    • ResizeRequest

      public ResizeRequest(String targetIndex, String sourceIndex)
      Creates a new resize request
      Parameters:
      targetIndex - the new index to create with resized shards
      sourceIndex - the index to resize
  • Method Details

    • setSettings

      public ResizeRequest setSettings(org.elasticsearch.common.settings.Settings settings)
      Sets the Settings to be used on the target index
    • getSettings

      public org.elasticsearch.common.settings.Settings getSettings()
      Returns the Settings to be used on the target index
    • setAliases

      public ResizeRequest setAliases(List<org.elasticsearch.action.admin.indices.alias.Alias> aliases)
      Sets the Aliases to be used on the target index
    • getAliases

      public Set<org.elasticsearch.action.admin.indices.alias.Alias> getAliases()
      Returns the Aliases to be used on the target index
    • setMaxPrimaryShardSize

      public void setMaxPrimaryShardSize(org.elasticsearch.common.unit.ByteSizeValue maxPrimaryShardSize)
      Sets the max primary shard size of the target index
    • getMaxPrimaryShardSize

      public org.elasticsearch.common.unit.ByteSizeValue getMaxPrimaryShardSize()
      Return the max primary shard size of the target index
    • validate

      public Optional<ValidationException> validate()
      Description copied from interface: Validatable
      Perform validation. This method does not have to be overridden in the event that no validation needs to be done, or the validation was done during object construction time. A ValidationException that is not null is assumed to contain validation errors and will be thrown.
      Specified by:
      validate in interface Validatable
      Returns:
      An Optional ValidationException that contains a list of validation errors.
    • getTargetIndex

      public String getTargetIndex()
      Returns the target index name
    • getSourceIndex

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

      public ResizeRequest setWaitForActiveShards(org.elasticsearch.action.support.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 ResizeRequest 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.
    • getWaitForActiveShards

      public org.elasticsearch.action.support.ActiveShardCount getWaitForActiveShards()
    • 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