to_boolean.asciidoc 725 B

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