to_boolean.asciidoc 694 B

123456789101112131415161718192021222324252627
  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,esql]
  10. ----
  11. include::{esql-specs}/boolean.csv-spec[tag=to_boolean]
  12. ----
  13. returns:
  14. [%header,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