where.asciidoc 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. [discrete]
  2. [[esql-where]]
  3. === `WHERE`
  4. **Syntax**
  5. [source,esql]
  6. ----
  7. WHERE expression
  8. ----
  9. *Parameters*
  10. `expression`::
  11. A boolean expression.
  12. *Description*
  13. The `WHERE` processing command produces a table that contains all the rows from
  14. the input table for which the provided condition evaluates to `true`.
  15. *Examples*
  16. [source,esql]
  17. ----
  18. include::{esql-specs}/docs.csv-spec[tag=where]
  19. ----
  20. Which, if `still_hired` is a boolean field, can be simplified to:
  21. [source,esql]
  22. ----
  23. include::{esql-specs}/docs.csv-spec[tag=whereBoolean]
  24. ----
  25. Use date math to retrieve data from a specific time range. For example, to
  26. retrieve the last hour of logs:
  27. [source,esql]
  28. ----
  29. include::{esql-specs}/date.csv-spec[tag=docsNowWhere]
  30. ----
  31. `WHERE` supports various <<esql-functions,functions>>. For example the
  32. <<esql-length>> function:
  33. [source,esql]
  34. ----
  35. include::{esql-specs}/docs.csv-spec[tag=whereFunction]
  36. ----
  37. For a complete list of all functions, refer to <<esql-functions>>.
  38. include::../functions/predicates.asciidoc[tag=body]
  39. include::../functions/like.asciidoc[tag=body]
  40. include::../functions/rlike.asciidoc[tag=body]
  41. include::../functions/in.asciidoc[tag=body]
  42. For a complete list of all operators, refer to <<esql-operators>>.