Elasticsearch(es)查询报错:Result window is too large, from + size must be less than or equal to: [10000] but was [20000 查询数据过大
{"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 [20000]. 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":"export","node":"scF9aemwTUuv9t0jPF0PrA","reason":{"type":"query_phase_execution_exception","reason":"Result window is too large, from + size must be less than or equal to: [10000] but was [20000]. 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."}}]},"status":500}
查看索引设置
GET export/_settings
es默认只能查询一万条,超过条数限制就需要设置索引
修改索引设置
PUT export/_settings { "index.max_result_window":100000 }
export是索引名称 ,上面表示修改查询限制为十万条
es不要查询大数据量,会很消耗内存
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek “源神”启动!「GitHub 热点速览」
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
· DeepSeek R1 简明指南:架构、训练、本地部署及硬件要求
· NetPad:一个.NET开源、跨平台的C#编辑器
2021-04-03 Java整合redis报错s if RDB snapshotting fails (stop-writes-on-bgsave-error option)
2021-04-03 价格BigDecimal的加减乘除、小数四舍五入、比较
2021-04-03 页码pageNo与SQL的limit进行换算
2021-04-03 mybatis注解版in查询、字符串判空模糊匹配 、批量插入、插入返回主键、判断集合是否为空