Document toolboxDocument toolbox

Limit the events of a widget query


You can limit the query events represented in a widget using the offset and limit operators.

offset

Add this operator to your query to discard the oldest number of events. If there aren't enough events available, the maximum number of events will be discarded. For example, a widget with the following source query will represent all the events in the selected time range except for the five oldest events.

query (from demo.ecommerce.data group every 0 by statusCode offset 5)

limit

Add this operator to your query to show only the oldest events. If there aren't enough events available, the maximum number of events will be shown. For example, a widget with the following source query will only represent the 10 oldest events that arrived in the selected time range.

query (from demo.ecommerce.data group every 0 by statusCode limit 10)

You can use both operators at the same time to get a specific window of events within a time range. For example, the following query will discard the five oldest events and will only show the 10 oldest ones from the remaining set.

query (from demo.ecommerce.data group every 0 by statusCode offset 5 limit 10)

When you use both operators, note that the order matters; if you use limit before offset, events will be discarded from the set of events specified in the limit parameter. So, if we switch the order of the operators in the previous example, query events will be first limited to the 10 oldest ones, and then the five oldest ones from that set will be discarded.

query (from demo.ecommerce.data group every 0 by statusCode limit 10 offset 5)

Queries without grouping

If your query does not group events, in order to use either of these operators, the query must include a select statement.