Creating buckets of a certain size from a set result size

Hello all,

I'm trying to create 25 buckets of 5 documents each where I can then do sub-aggregations. So far my query looks like this:

"size": 125,
  "sort": [
      "datetime": {
        "order": "desc"
      "id": {
        "order": "desc"

The buckets I want will take the first five documents and put them together, then do the same with the remaining documents until I have 25 buckets. I tried a histogram aggregation but it was repeating documents and leaving out others.

Any ideas on what I can do?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.