Elasticsearch Aggregation Pagination

时间:2018-01-08 09:22:26

标签: elasticsearch pagination aggregate spring-data-elasticsearch elasticsearch-2.4

使用带聚合的弹性搜索有没有办法进行分页? elasticsearch版本是2.3。 这是查询:

{
  "query": {
    "match": {
      "clientMac": "88:"
    }
  },
  "aggs": {
    "top_tags": {
      "terms": {
        "field": "clientMac.rawData"
      },
      "aggs": {
        "top_client_hits": {
          "top_hits": {
            "sort": [
              {
                "event_timestamp": {
                  "order": "desc"
                }
              }
            ],
            "_source": {
              "includes": [
                "event_timestamp"
              ]
            },
            "size": 1
          }
        }
      }
    }
  }
}

1 个答案:

答案 0 :(得分:0)

从弹性5开始,您可以通过对术语聚合的分区进行分区。你可以在这里读到它: https://www.elastic.co/guide/en/elasticsearch/reference/5.5/search-aggregations-bucket-terms-aggregation.html#_filtering_values_with_partitions