在elasticsearch中获取第N页数据进行复合聚合的正确方法是什么?

What is the correct way to get Nth page's datas for composite aggregation in elasticsearch?

We can do pagination for composite aggregation using with "After"。但是,当我们使用 "After" 时,它只会给我们下一页。如何直接获取第N页或上一页的数据?

GET /_search
{
    "aggs" : {
        "my_buckets": {
            "composite" : {
                "size": 2,
                 "sources" : [
                    { "date": { "date_histogram": { "field": "timestamp", "calendar_interval": "1d", "order": "desc" } } },
                    { "product": { "terms": {"field": "product", "order": "asc" } } }
                ],
                "after": { "date": 1494288000000, "product": "mad max" } 
            }
        }
    }
}

不,不能直接请求特定页面,您需要分页,直到到达您需要的 "page"。