case.asciidoc 461 B

1234567891011121314151617
  1. [[esql-case]]
  2. === `CASE`
  3. Accepts pairs of conditions and values. The function returns the value that
  4. belongs to the first condition that evaluates to `true`. If the number of
  5. arguments is odd, the last argument is the default value which is returned when
  6. no condition matches.
  7. [source,esql]
  8. ----
  9. FROM employees
  10. | EVAL type = CASE(
  11. languages <= 1, "monolingual",
  12. languages <= 2, "bilingual",
  13. "polyglot")
  14. | PROJECT first_name, last_name, type
  15. ----