# Paging aggregations

**URL:** <https://discuss.elastic.co/t/paging-aggregations/29426>\
**Category:** Elasticsearch\
**Created:** [September 16, 2015, 4:23pm UTC](https://discuss.elastic.co/t/paging-aggregations/29426 "2015-09-16T16:23:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hugohenrique](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hugohenrique/32/4820_2.png) [@hugohenrique](https://discuss.elastic.co/u/hugohenrique)\
**Post date:** [September 16, 2015, 4:23pm UTC](https://discuss.elastic.co/t/paging-aggregations/29426/1 "2015-09-16T16:23:26Z")

</div>

Ever had the need, or know how the paging aggregates.

I saw that with sub-aggregate top\_hits is possible but I am using the terms \> top\_hits.

There is an open issue: [https://github.com/elastic/elasticsearch/issues/4915](https://github.com/elastic/elasticsearch/issues/4915) and apparently the discussion is open, which unfortunately from what I understand is not a definition.

Many people have recommended page on the client side.

With the query:

```
{
  "size": 0,
  "sort": [{
    "_score": {
      "order": "desc"
    }
  }]
  "query": {
    "match": {
      "name": "something"
    }
  },
  "aggs": {
    "keywords": {
      "terms": {
        "field": "supplier",
        "size": 10
      },
      "aggs": {
        "top_keywords_hits": {
          "top_hits": {
            "sort": [{
              "_score": {
                "order": "desc"
              }
            }],
            "_source": {
              "include": ["name", "supplier"]
            },
            "size": 1
          }
        }
      }
    }
  }
}
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:49pm UTC](https://discuss.elastic.co/t/paging-aggregations/29426/2 "2017-07-05T23:49:54Z")

</div>


