请问如何在ClickHouse中实现分页?例如,我在Elasticsearch中执行以下聚合查询:使用参数分区编号和分区大小来获取结果。假设我们有100条记录,如果我们将分区大小设置为10,分区编号设置为2,则我们将获得最新的11-20条记录。
考虑到数据插入表中,那么在ClickHouse中该如何实现呢?
SearchResponse response = elasticClient.prepareSearch(index)
.setTypes(documentType)
.setQuery(boolQueryBuilder)
.setSize(0)
.addAggregation(AggregationBuilders.terms("unique_uids")
.field(Constants.UID_NAME)
.includeExclude(new IncludeExclude(partition,numPartitions))
.size(Integer.MAX_VALUE))
.get();