1
0

from.asciidoc 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. [discrete]
  2. [[esql-from]]
  3. === `FROM`
  4. **Syntax**
  5. [source,esql]
  6. ----
  7. FROM index_pattern [METADATA fields]
  8. ----
  9. *Parameters*
  10. `index_pattern`::
  11. A list of indices, data streams or aliases. Supports wildcards and date math.
  12. `fields`::
  13. A comma-separated list of <<esql-metadata-fields,metadata fields>> to retrieve.
  14. *Description*
  15. The `FROM` source command returns a table with data from a data stream, index,
  16. or alias. Each row in the resulting table represents a document. Each column
  17. corresponds to a field, and can be accessed by the name of that field.
  18. [NOTE]
  19. ====
  20. By default, an {esql} query without an explicit <<esql-limit>> uses an implicit
  21. limit of 1000. This applies to `FROM` too. A `FROM` command without `LIMIT`:
  22. [source,esql]
  23. ----
  24. FROM employees
  25. ----
  26. is executed as:
  27. [source,esql]
  28. ----
  29. FROM employees
  30. | LIMIT 1000
  31. ----
  32. ====
  33. *Examples*
  34. [source,esql]
  35. ----
  36. FROM employees
  37. ----
  38. You can use <<api-date-math-index-names,date math>> to refer to indices, aliases
  39. and data streams. This can be useful for time series data, for example to access
  40. today's index:
  41. [source,esql]
  42. ----
  43. FROM <logs-{now/d}>
  44. ----
  45. Use comma-separated lists or wildcards to query multiple data streams, indices,
  46. or aliases:
  47. [source,esql]
  48. ----
  49. FROM employees-00001,other-employees-*
  50. ----
  51. Use the format `<remote_cluster_name>:<target>` to query data streams and indices
  52. on remote clusters:
  53. [source,esql]
  54. ----
  55. FROM cluster_one:employees-00001,cluster_two:other-employees-*
  56. ----
  57. See <<esql-cross-clusters, using {esql} across clusters>>.
  58. Use the optional `METADATA` directive to enable <<esql-metadata-fields,metadata fields>>:
  59. [source,esql]
  60. ----
  61. FROM employees METADATA _id
  62. ----