You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/reference/esql/processing-commands/limit.asciidoc
+40-10Lines changed: 40 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,24 +22,54 @@ The maximum number of rows to return.
22
22
The `LIMIT` processing command enables you to limit the number of rows that are
23
23
returned.
24
24
// tag::limitation[]
25
-
Queries do not return more than 10,000 rows, regardless of the `LIMIT` command's
26
-
value.
25
+
For instance,
26
+
```
27
+
FROM index | WHERE field = "value"
28
+
```
29
+
is equivalent to:
30
+
```
31
+
FROM index | WHERE field = "value" | LIMIT 1000
32
+
```
27
33
28
-
This limit only applies to the number of rows that are retrieved by the query.
29
-
Queries and aggregations run on the full data set.
34
+
Queries do not return more than 10,000 rows, regardless of the `LIMIT` command’s value. This is a configurable upper limit.
30
35
31
36
To overcome this limitation:
32
37
33
-
* Reduce the result set size by modifying the query to only return relevant
34
-
data. Use <<esql-where>> to select a smaller subset of the data.
35
-
* Shift any post-query processing to the query itself. You can use the {esql}
36
-
<<esql-stats-by>> command to aggregate data in the query.
38
+
* Reduce the result set size by modifying the query to only return relevant data. Use <<esql-where>> to select a smaller subset of the data.
39
+
* Shift any post-query processing to the query itself. You can use the {esql} <<esql-stats-by>> command to aggregate data in the query.
37
40
38
-
The default and maximum limits can be changed using these dynamic cluster
39
-
settings:
41
+
The upper limit only applies to the number of rows that are output by the query, not to the number of documents it processes: the query runs on the full data set.
42
+
43
+
Consider the following two queries:
44
+
```
45
+
FROM index | WHERE field0 == "value" | LIMIT 20000
46
+
```
47
+
and
48
+
```
49
+
FROM index | STATS AVG(field1) BY field2 | LIMIT 20000
50
+
```
51
+
52
+
In both cases, the filtering by `field0` in the first query or the grouping by `field2` in the second is applied over all the documents present in the `index`, irrespective of their number or indexes size. However, both queries will return at most 10,000 rows, even if there were more rows available to return.
53
+
54
+
The default and maximum limits can be changed using these dynamic cluster settings:
40
55
41
56
* `esql.query.result_truncation_default_size`
42
57
* `esql.query.result_truncation_max_size`
58
+
59
+
However, doing so involves trade-offs. A larger result-set involves a higher memory pressure and increased processing times; the internode traffic within and across clusters can also increase.
60
+
61
+
These limitations are similar to those enforced by the <<paginate-search-results>>.
0 commit comments