Class ResizeNumberOfShardsCalculator.CloneShardsCalculator

java.lang.Object
org.elasticsearch.action.admin.indices.shrink.ResizeNumberOfShardsCalculator.CloneShardsCalculator
All Implemented Interfaces:
ResizeNumberOfShardsCalculator
Enclosing interface:
ResizeNumberOfShardsCalculator

public static class ResizeNumberOfShardsCalculator.CloneShardsCalculator extends Object implements ResizeNumberOfShardsCalculator
  • Constructor Details

    • CloneShardsCalculator

      public CloneShardsCalculator()
  • Method Details

    • calculate

      public int calculate(Integer numberOfShards, ByteSizeValue maxPrimaryShardSize, IndexMetadata sourceMetadata)
      Description copied from interface: ResizeNumberOfShardsCalculator
      Calculates the target number of shards based on the parameters of the request
      Specified by:
      calculate in interface ResizeNumberOfShardsCalculator
      Parameters:
      numberOfShards - requested number of shards or null if it was not provided
      maxPrimaryShardSize - requested max primary shard size or null if it was not provided
      sourceMetadata - the index metadata of the source index
      Returns:
      the number of shards for the target index
    • validate

      public void validate(int numberOfShards, IndexMetadata sourceMetadata)
      Description copied from interface: ResizeNumberOfShardsCalculator
      Validates the target number of shards based on the operation. For example, in the case of SHRINK it will check if the doc count per shard is within limits and in the other opetations it will ensure we get the right exceptions if the number of shards is wrong or less than etc.
      Specified by:
      validate in interface ResizeNumberOfShardsCalculator
      Parameters:
      numberOfShards - the number of shards the target index is going to have
      sourceMetadata - the index metadata of the source index