esql-source-commands.asciidoc 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. [[esql-source-commands]]
  2. == Source commands
  3. An ESQL source command produces a table, typically with data from {es}.
  4. image::images/esql/source-command.svg[A source command producing a table from {es},align="center"]
  5. ESQL supports these source commands:
  6. * <<esql-from>>
  7. * <<esql-row>>
  8. * <<esql-show>>
  9. [[esql-from]]
  10. === `FROM`
  11. The `FROM` source command returns a table with up to 10,000 documents from a
  12. data stream, index, or alias. Each row in the resulting table represents a
  13. document. Each column corresponds to a field, and can be accessed by the name
  14. of that field.
  15. [source,esql]
  16. ----
  17. FROM employees
  18. ----
  19. You can use <<api-date-math-index-names,date math>> to refer to indices, aliases
  20. and data streams. This can be useful for time series data, for example to access
  21. today's index:
  22. [source,esql]
  23. ----
  24. FROM <logs-{now/d}>
  25. ----
  26. Use comma-separated lists or wildcards to query multiple data streams, indices,
  27. or aliases:
  28. [source,esql]
  29. ----
  30. FROM employees-00001,employees-*
  31. ----
  32. [[esql-row]]
  33. === `ROW`
  34. The `ROW` source command produces a row with one or more columns with values
  35. that you specify. This can be useful for testing.
  36. [source,esql]
  37. ----
  38. ROW a = 1, b = "two", c = null
  39. ----
  40. `ROW` supports the use of <<esql-functions,functions>>:
  41. [source,esql]
  42. ----
  43. ROW a = ROUND(1.23, 0)
  44. ----
  45. [[esql-show]]
  46. === `SHOW <item>`
  47. The `SHOW <item>` source command returns information about the deployment and
  48. its capabilities:
  49. * Use `SHOW INFO` to return the deployment's version, build date and hash.
  50. * Use `SHOW FUNCTIONS` to return a list of all supported functions and a
  51. synopsis of each function.