Class AllocationConstraints

java.lang.Object
org.opensearch.cluster.routing.allocation.AllocationConstraints

public class AllocationConstraints
extends java.lang.Object
Allocation constraints specify conditions which, if breached, reduce the priority of a node for receiving shard allocations.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    long CONSTRAINT_WEIGHT  
  • Constructor Summary

    Constructors 
    Constructor Description
    AllocationConstraints()  
  • Method Summary

    Modifier and Type Method Description
    long weight​(BalancedShardsAllocator.Balancer balancer, BalancedShardsAllocator.ModelNode node, java.lang.String index)
    Evaluates configured allocation constraint predicates for given node - index combination; and returns a weight value based on the number of breached constraints.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • weight

      public long weight​(BalancedShardsAllocator.Balancer balancer, BalancedShardsAllocator.ModelNode node, java.lang.String index)
      Evaluates configured allocation constraint predicates for given node - index combination; and returns a weight value based on the number of breached constraints. Constraint weight should be added to the weight calculated via weight function, to reduce priority of allocating on nodes with breached constraints. This weight function is used only in case of unassigned shards to avoid overloading a newly added node. Weight calculation in other scenarios like shard movement and re-balancing remain unaffected by this function.