limit.asciidoc 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. [discrete]
  2. [[esql-limit]]
  3. === `LIMIT`
  4. **Syntax**
  5. [source,esql]
  6. ----
  7. LIMIT max_number_of_rows
  8. ----
  9. *Parameters*
  10. `max_number_of_rows`::
  11. The maximum number of rows to return.
  12. *Description*
  13. The `LIMIT` processing command enables you to limit the number of rows that are
  14. returned.
  15. // tag::limitation[]
  16. Queries do not return more than 10,000 rows, regardless of the `LIMIT` command's
  17. value.
  18. This limit only applies to the number of rows that are retrieved by the query.
  19. Queries and aggregations run on the full data set.
  20. To overcome this limitation:
  21. * Reduce the result set size by modifying the query to only return relevant
  22. data. Use <<esql-where>> to select a smaller subset of the data.
  23. * Shift any post-query processing to the query itself. You can use the {esql}
  24. <<esql-stats-by>> command to aggregate data in the query.
  25. The default and maximum limits can be changed using these dynamic cluster
  26. settings:
  27. * `esql.query.result_truncation_default_size`
  28. * `esql.query.result_truncation_max_size`
  29. // end::limitation[]
  30. *Example*
  31. [source,esql]
  32. ----
  33. include::{esql-specs}/limit.csv-spec[tag=basic]
  34. ----