ES报错Result window is too large问题处理

简介:

我在使用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,如需转载请自行联系原作者

目录
相关文章
|
2天前
|
索引
filebeat 设置索引的 max_result_window
在 Filebeat 中设置索引的 max_result_window 需要修改 Elasticsearch 的索引模板。max_result_window 参数定义了在 Elasticsearch 中执行搜索时,最大返回文档的数量。默认情况下,该值为 10000。 要修改该值,可以按照以下步骤操作: 打开 Filebeat 的配置文件。 找到输出部分,其中定义了 Elasticsearch 输出。 在 Elasticsearch 输出配置中,找到索引模板相关的配置。 确保你已经定义了自定义的索引模板(如果没有,请创建一个)。 在索引模板中,设置 max_result_window 参数为
|
28天前
Angular启动/node_modules/@types/node/index.d.ts (20,1): Invalid ‘reference‘ directive syntax.
Angular启动/node_modules/@types/node/index.d.ts (20,1): Invalid ‘reference‘ directive syntax.
20 2
|
4月前
|
JavaScript
【Vue Error】 error Component name “product“ should always be multi-word vue/multi-word-compone……
【Vue Error】 error Component name “product“ should always be multi-word vue/multi-word-compone……
|
5月前
|
JavaScript 前端开发 开发者
ts详解以及相关例子(一篇带你详细了解ts)
ts详解以及相关例子(一篇带你详细了解ts)
42 1
|
8月前
|
索引
Result window is too large, from + size must be less than or equal to: [10000]
Result window is too large, from + size must be less than or equal to: [10000]
65 0
|
9月前
打包报错Error: ‘default‘ is not exported by node_modules/qs/lib/index.js
打包报错Error: ‘default‘ is not exported by node_modules/qs/lib/index.js
198 0
|
10月前
【TS】ts中的类:class
【TS】ts中的类:class
71 0
【TS】ts中的类:class
|
安全 JavaScript
TS中的unknown类型
TS中的unknown类型
138 0
why I cannot get any search result from P8F
why I cannot get any search result from P8F
87 0
why I cannot get any search result from P8F
SAP UI5 different cache results
Created by Wang, Jerry, last modified on Dec 13, 2016
SAP UI5 different cache results