当前位置:网站首页>iServer发布ES服务查询设置最大返回数量
iServer发布ES服务查询设置最大返回数量
2022-06-30 11:59:00 【supermapsupport】
作者:lly
一、问题详情
当我们发布ES服务为数据服务,进行查询时,发现当查询的返回的结果超过1W条时,会查询失败,报错“all shards failed”。
二、错误排查
1.通过对错误的排查,发现和iServer的关联不大,而是ES本身的限制,当用elasticsearch进行深度分页查询时的size-from大于10000的时候,就会报错“org.elasticsearch.search.query.QueryPhaseExecutionException”
Caused by: org.elasticsearch.search.query.QueryPhaseExecutionException: Result window is too large, from + size must be less than or equal to: [10000] but was [19998]. 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.
at org.elasticsearch.search.DefaultSearchContext.preProcess(DefaultSearchContext.java:206) ~[elasticsearch-6.1.1.jar!/:6.1.1]
at org.elasticsearch.search.query.QueryPhase.preProcess(QueryPhase.java:90) ~[elasticsearch-6.1.1.jar!/:6.1.1]
at org.elasticsearch.search.SearchService.createContext(SearchService.java:564) ~[elasticsearch-6.1.1.jar!/:6.1.1]
at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:528) ~[elasticsearch-6.1.1.jar!/:6.1.1]
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:324) ~[elasticsearch-6.1.1.jar!/:6.1.1]
at org.elasticsearch.search.SearchService$2.onResponse(SearchService.java:310) ~[elasticsearch-6.1.1.jar!/:6.1.1]
... 9 common frames omitted
2.根据报错,我们发现是需要去设置index.max_result_window参数去调大能返回的最大值,我们可以通过一下请求,来对ES所有索引进行设置
var settings = {
"url": "127.0.0.1:9200/_settings",
"method": "PUT",
"timeout": 0,
"headers": {
"Content-Type": "application/json"
},
"data": JSON.stringify({
"index.max_result_window": "2000000000"
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
3.设置完成后,我们访问http://172.16.15.124:9200/huawei1/_settings?pretty,可以看到已成功设置,再次查询即可成功返回。
三、注意事项
index.max_result_window参数是integer类型,不能设置得无限大。
边栏推荐
猜你喜欢
随机推荐
DMA controller 8237a
Typescript readonlyarray (read only array type) details
立创 EDA #学习笔记10# | 常用连接器元器件识别 和 无源蜂鸣器驱动电路
A Generic Deep-Learning-Based Approach for Automated Surface Inspection-论文阅读笔记
通过EF Core框架根据SQL Server数据库表生成实体类
Go zero micro Service Practice Series (VIII. How to handle tens of thousands of order requests per second)
Getting started with the go language is simple: go handles XML files
【LeetCode】15、三数之和
695. maximum island area
Quel est le rôle du rétroéclairage LED?
浏览器播放rtsp视频,基于nodeJs
Review the writing software with characteristics
How difficult is data governance and data innovation?
Goto statement jump uninitialized variable: c2362
go-zero微服务实战系列(八、如何处理每秒上万次的下单请求)
Redis - SDS simple dynamic string
Conference Preview - Huawei 2012 lab global software technology summit - European session
聊聊怎么做硬件兼容性检测,快速迁移到openEuler?
Another miserable day by kotlin grammar
光谱共焦位移传感器的原理是什么?能应用那些领域?








