【问题标题】:What is the correct way to get Nth page's datas for composite aggregation in elasticsearch?在elasticsearch中获取第N页数据以进行复合聚合的正确方法是什么?
【发布时间】:2020-05-14 21:06:05
【问题描述】:

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 nest elasticsearch-aggregation


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2021-02-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-19
      相关资源
      最近更新 更多