Paging aggregations


(Hugo Henrique) #1

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 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
          }
        }
      }
    }
  }
}

(system) #2