Loading

ES|QL conditional functions and expressions

Conditional functions return one of their arguments by evaluating in an if-else manner. ES|QL supports these conditional functions:

  • CASE

    Returns the value for the first condition that evaluates to true.

  • COALESCE

    Returns the first of its arguments that is not null.

  • GREATEST

    Returns the maximum value from multiple columns.

  • LEAST

    Returns the minimum value from multiple columns.

  • CLAMP

    Clamps values to a specified minimum and maximum range.

  • CLAMP_MIN

    Clamps input values to a lower bound, raising any value below min to min.

  • CLAMP_MAX

    Clamps input values to an upper bound, reducing any value above max to max.