1
0

esql-source-commands.asciidoc 1.8 KB

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