博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ES报错Result window is too large问题处理
阅读量:6989 次
发布时间:2019-06-27

本文共 1643 字,大约阅读时间需要 5 分钟。

我在使用Elasticsearch进行search查询的过程中,出现了Result window is too large问题。
这里简单做一个报错复现:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
In [
1
]: 
import 
requests
 
In [
2
]: requests.get(
'http://127.0.0.1:9200/cmdb-now/_search?page=1&size=10000000'
).json()
Out[
2
]:
{
    
u
'error'
: {
        
u
'failed_shards'
: [
            
{
                
u
'index'
: u
'cmdb-now'
,
                
u
'node'
: u
'ldeZMZRAR6uZpAiIr5QxBQ'
,
                
u
'reason'
: {
                    
u
'reason'
: u
'Result window is too large, from + size must be less than or equal to: [10000] but was [10000000]. 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 parameter.'
,
                    
u
'type'
: u
'query_phase_execution_exception'
                
},
                
u
'shard'
0
            
}
        
],
        
u
'grouped'
True
,
        
u
'phase'
: u
'query'
,
        
u
'reason'
: u
'all shards failed'
,
        
u
'root_cause'
: [
            
{
                
u
'reason'
: u
'Result window is too large, from + size must be less than or equal to: [10000] but was [10000000]. 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 parameter.'
,    
                
u
'type'
: u
'query_phase_execution_exception'
            
}
        
],
        
u
'type'
: u
'search_phase_execution_exception'
    
},
    
u
'status'
500
}

从上面的报错信息,可以看到ES提示我结果窗口太大了,目前最大值为10000,而我却要求给我10000000。并且在后面也提到了要求我修改index.max_result_window参数来增大结果窗口大小。

我google了修改方法,命令如下:

1
curl -XPUT http:
//127
.0.0.1:9200
/cmdb-now/_settings 
-d 
'{ "index" : { "max_result_window" : 100000000}}'

需要注意的是,cmdb-now这里是我ES索引的名字,因此你需要它替换成你对应的索引名称进行修改。
有关官方针对index的相关配置介绍,可以进行查看。

本文转自 aaao 51CTO博客,原文链接:http://blog.51cto.com/nolinux/1786656,如需转载请自行联系原作者
你可能感兴趣的文章
回收站的东西如何恢复?教你几个实用的
查看>>
Mysql和Oracle数据库concat()函数
查看>>
研究显示AI正创造更多工作岗位
查看>>
DB2 SQL statement too long or complex.
查看>>
OpenGL 版本升级
查看>>
纯做技术是自娱自乐,抛开技术做技术才是出路
查看>>
mySQL练习题
查看>>
常用安装rpm包--必备命令
查看>>
表单验证 018
查看>>
Java字节码3-使用ByteBuddy实现一个Java-Agent
查看>>
程序有没有可能输出y=2而x!=1的情况?如果可能,x可能会是什么值?如果不可能,为什么?...
查看>>
[笔记] mysql-proxy 实现主从读写分离
查看>>
给GRUB中的菜单加入密码。
查看>>
保留原有插件,快速升级Eclipse发行版本
查看>>
7月第1周国内域名商TOP10:万网DNSPOD差距缩小
查看>>
debian配置sambd
查看>>
整理grep实战文本搜索过滤技巧
查看>>
Samba通过Openldap统一认证
查看>>
我的友情链接
查看>>
阿里云CDN技术掌舵人文景:相爱相杀一路狂奔的这十年
查看>>