46 lines
846 B
Plaintext
46 lines
846 B
Plaintext
[discrete]
|
|
[[esql-to_boolean]]
|
|
=== `TO_BOOLEAN`
|
|
|
|
*Alias*
|
|
|
|
`TO_BOOL`
|
|
|
|
*Syntax*
|
|
|
|
[source,esql]
|
|
----
|
|
TO_BOOLEAN(v)
|
|
----
|
|
|
|
*Parameters*
|
|
|
|
`v`::
|
|
Input value. The input can be a single- or multi-valued column or an expression.
|
|
|
|
*Description*
|
|
|
|
Converts an input value to a boolean value.
|
|
|
|
A string value of *"true"* will be case-insensitive converted to the Boolean
|
|
*true*. For anything else, including the empty string, the function will
|
|
return *false*.
|
|
|
|
The numerical value of *0* will be converted to *false*, anything else will be
|
|
converted to *true*.
|
|
|
|
*Supported types*
|
|
|
|
The input type must be of a string or numeric type.
|
|
|
|
*Example*
|
|
|
|
[source.merge.styled,esql]
|
|
----
|
|
include::{esql-specs}/boolean.csv-spec[tag=to_boolean]
|
|
----
|
|
[%header.monospaced.styled,format=dsv,separator=|]
|
|
|===
|
|
include::{esql-specs}/boolean.csv-spec[tag=to_boolean-result]
|
|
|===
|