where.asciidoc 1.2 KB

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