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不要查询大数据量,会很消耗内存

 

posted @   yvioo  阅读(169)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 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查询、字符串判空模糊匹配 、批量插入、插入返回主键、判断集合是否为空
点击右上角即可分享
微信分享提示