java.lang.Object
org.elasticsearch.xpack.esql.plan.logical.promql.selector.LabelMatcher
All Implemented Interfaces:
NodeStringRenderable

public class LabelMatcher extends Object implements NodeStringRenderable
PromQL label matcher between a label name, a value pattern and match type (=, !=, =~, !~). Examples: {job="api"} -> [LabelMatcher("job", "api", EQ)] {status=~"5.."} -> [LabelMatcher("status", "5..", REG)] {env!~"test|dev"} -> [LabelMatcher("env", "test|dev", NREG)] {host=?_hosts} -> [LabelMatcher("host", ["34.107.161.234", "140.248.133.94"], EQ)]
  • Field Details

  • Constructor Details

  • Method Details

    • name

      public String name()
    • getFirstValue

      public String getFirstValue()
      Returns the single value for this matcher. For multi-value matchers, returns the first value. Use values() to get all values.
    • values

      public List<String> values()
      Returns all values for this matcher. For single-value matchers, returns a singleton list.
    • isMultiValue

      public boolean isMultiValue()
      Returns true if this matcher has multiple values.
    • matcher

      public LabelMatcher.Matcher matcher()
    • automaton

      public org.apache.lucene.util.automaton.Automaton automaton()
    • matchesAll

      public boolean matchesAll()
    • matchesNone

      public boolean matchesNone()
    • matchesEmpty

      public boolean matchesEmpty()
    • isNegation

      public boolean isNegation()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • nodeString

      public void nodeString(StringBuilder sb, Node.NodeStringFormat format, NodeStringMapper mapper)
      Routes the label name and every match value through the mapper (the match operator is structural and stays). Reproduces toString()'s name op [v1, v2] shape so that under NodeStringMapper.IDENTITY this equals toString(); under an anonymizing mapper the label name and the (potentially sensitive) values tokenize.
      Specified by:
      nodeString in interface NodeStringRenderable