Aggregate on Pagniated Query


I’m doing a query and then aggregating the results. The query itself is paginated (I use from:0 and size:20). However, the data that is passed to aggregate is not this pagniated query, but the total matching hits.

Is that correct?

Is there a way to pass only the paginated query results for aggregation