to_boolean.asciidoc 714 B

123456789101112131415161718192021222324
  1. [[esql-to_boolean]]
  2. === `TO_BOOLEAN`
  3. Converts an input value to a boolean value.
  4. The input can be a single- or multi-valued field or an expression. The input
  5. type must be of a string or numeric type.
  6. A string value of *"true"* will be case-insensitive converted to the Boolean
  7. *true*. For anything else, including the empty string, the function will
  8. return *false*. For example:
  9. [source.merge.styled,esql]
  10. ----
  11. include::{esql-specs}/boolean.csv-spec[tag=to_boolean]
  12. ----
  13. [%header.monospaced.styled,format=dsv,separator=|]
  14. |===
  15. include::{esql-specs}/boolean.csv-spec[tag=to_boolean-result]
  16. |===
  17. The numerical value of *0* will be converted to *false*, anything else will be
  18. converted to *true*.
  19. Alias: TO_BOOL