Class PreferHasAttributeNodeSelector

java.lang.Object
org.opensearch.client.PreferHasAttributeNodeSelector
All Implemented Interfaces:
NodeSelector

public final class PreferHasAttributeNodeSelector extends Object implements NodeSelector
Both PreferHasAttributeNodeSelector and HasAttributeNodeSelector will work the same if there is a Node with particular attribute in the attributes, but PreferHasAttributeNodeSelector will select another Nodes even if there is no Node with particular attribute in the attributes.
  • Constructor Details

    • PreferHasAttributeNodeSelector

      public PreferHasAttributeNodeSelector(String key, String value)
      Creates a PreferHasAttributeNodeSelector instance with the given key value pair.
      Parameters:
      key - attribute key
      value - attribute value
  • Method Details

    • select

      public void select(Iterable<Node> nodes)
      Select the Nodes to which to send requests.
      Specified by:
      select in interface NodeSelector
      Parameters:
      nodes - the Nodes targeted for the sending requests
    • equals

      public boolean equals(Object o)
      Compare two node selectors for equality
      Overrides:
      equals in class Object
      Parameters:
      o - node selector instance to compare with
    • hashCode

      public int hashCode()
      Calculate the hash code of the node selector
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Convert this node selector to string representation
      Overrides:
      toString in class Object