es 深度分页问题

Elasticsearch的from/size分页存在max_window_size限制,超过10000会导致错误。为解决深度分页问题,可以使用scroll API,但不适合跳页场景;search_after依赖稳定排序,适用于连续翻页。注意,scroll和search_after不适用于频繁的页数跳转,且资源消耗较大。
摘要由CSDN通过智能技术生成

es 深度分页问题

背景

使用es的from/size进行常规的分页操作时,有一个max_window_size限制,大小默认是10000,当from+size > 10000时,会有如下报错:

    "error": {
        "root_cause": [
            {
                "type": "query_phase_execution_exception",
                "reason": "Result window is too large, from + size must be less than or equal to: [10000] but was [10001]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting."
            }
        ],
        "type": "search_phase_execution_exception",
        "reason": "all shards failed",
        "phase": "query",
        "grouped": true,
        "failed_shards": [
            {
                "shard": 0,
                "index": &#
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值