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
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.action.admin.indices.shrink.ResizeNumberOfShardsCalculator
ResizeNumberOfShardsCalculator.CloneShardsCalculator, ResizeNumberOfShardsCalculator.ShrinkShardsCalculator, ResizeNumberOfShardsCalculator.SplitShardsCalculator
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
calculate
(Integer numberOfShards, ByteSizeValue maxPrimaryShardSize, IndexMetadata sourceMetadata) Calculates the target number of shards based on the parameters of the requestvoid
validate
(int numberOfShards, IndexMetadata sourceMetadata) Validates the target number of shards based on the operation.
-
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 interfaceResizeNumberOfShardsCalculator
- Parameters:
numberOfShards
- requested number of shards or null if it was not providedmaxPrimaryShardSize
- requested max primary shard size or null if it was not providedsourceMetadata
- the index metadata of the source index- Returns:
- the number of shards for the target index
-
validate
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 interfaceResizeNumberOfShardsCalculator
- Parameters:
numberOfShards
- the number of shards the target index is going to havesourceMetadata
- the index metadata of the source index
-