Search: Filter data after an aggregation

Hi community.
I have made a query to obtain the average number of bytes per browser type, but I require that only the data that has an average less than 5000 be displayed or retrieved.
I have read a lot but nothing concrete about how to filter AFTER doing an aggregation with numerical data, (filtering after...not before).
If anyone has the answer, I'd be deeply grateful.

Hey,

I think you are looking for the Bucket Selector aggregation.

Please let me know if it is what you were looking for,

Tim

It was the perfect solution. Thank you!