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

标签 elasticsearch nest elasticsearch-aggregation

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

最佳答案

不,不可能直接请求特定页面,您需要先分页直到到达所需的“页面”。

关于elasticsearch - 在Elasticsearch中获取第N页数据进行复合聚合的正确方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59965874/

相关文章:

elasticsearch - 在elasticsearch中按计数过滤

使用 lucene 模糊运算符时,Elasticsearch 查询和过滤器会给出不同的文档计数

elasticsearch - 如何根据 Elasticsearch 中的特定字段获取非空值的计数

elasticsearch - 获取桶中所有文档的总数

elasticsearch - 使用Nest 7.x重新创建ElasticSearch索引

elasticsearch - 在多重搜索查询上使用嵌套短语建议程序

c# - ElasticSearch NEST 2.4中的自定义 “tab” token 生成器

elasticsearch - 从具有唯一ID的组中返回具有最新时间戳的日志

elasticsearch - 获取所有时间date_histogram存储桶结果

elasticsearch - 在 Elasticsearch 版本 6.2.3 中获取多个字段的唯一记录