to_boolean.asciidoc 846 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. [discrete]
  2. [[esql-to_boolean]]
  3. === `TO_BOOLEAN`
  4. *Alias*
  5. `TO_BOOL`
  6. *Syntax*
  7. [source,esql]
  8. ----
  9. TO_BOOLEAN(v)
  10. ----
  11. *Parameters*
  12. `v`::
  13. Input value. The input can be a single- or multi-valued column or an expression.
  14. *Description*
  15. Converts an input value to a boolean value.
  16. A string value of *"true"* will be case-insensitive converted to the Boolean
  17. *true*. For anything else, including the empty string, the function will
  18. return *false*.
  19. The numerical value of *0* will be converted to *false*, anything else will be
  20. converted to *true*.
  21. *Supported types*
  22. The input type must be of a string or numeric type.
  23. *Example*
  24. [source.merge.styled,esql]
  25. ----
  26. include::{esql-specs}/boolean.csv-spec[tag=to_boolean]
  27. ----
  28. [%header.monospaced.styled,format=dsv,separator=|]
  29. |===
  30. include::{esql-specs}/boolean.csv-spec[tag=to_boolean-result]
  31. |===