limit.asciidoc 1.2 KB

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