Normally, the events in a bucket are kept by order of arrival. You can specify a different ordering by the fields of the events.
eventCache(instream, d desc) e0;
You can order by more than one field.
The following example orders the buckets
by field d0 in descending order,
then by field d1 in ascending order
in case the d0 fields are equal.
eventCache(instream, d0 desc, d1 asc) e0;