当前位置:网站首页>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类型,不能设置得无限大。
边栏推荐
- Flutter 从零开始 006 单选开关和复选框
- Flutter 从零开始 005 图片及Icon
- 剑指 Offer 05. 替换空格: 把字符串 s 中的每个空格替换成“%20“
- The website with id 0 that was requested wasn‘t found. Verify the website and try again
- Typescript readonlyarray (read only array type) details
- A Generic Deep-Learning-Based Approach for Automated Surface Inspection-论文阅读笔记
- Talk about how to do hardware compatibility testing and quickly migrate to openeuler?
- 智慧法院新征程,无纸化办公,护航智慧法院绿色庭审
- Joplin实现样式更改
- It is said that with this, the boss opened the test overnight
猜你喜欢

不同类型的变量与零究竟是如何比较

zabbix监控TCP连接个数

【LeetCode】15、三数之和

Hannaiping of Qilin software: the construction of Digital China needs its own open source root community

Boost study: boost log

60 divine vs Code plug-ins!!

wallys/600VX – 2 × 2 MIMO 802.11ac Mini PCIe Wi-Fi Module, Dual Band, 2,4GHz / 5GHz QCA 9880

治数如治水,数据治理和数据创新难在哪?

Joplin实现样式更改

nvm安装node后,在使用npm指令时候显示不是内部或外部指令
随机推荐
It is said that with this, the boss opened the test overnight
R language ggplot2 visualization: use ggplot2 to visualize the scatter diagram, and_ Set the alpha parameter in the point parameter to specify the transparency level of data points (points transparent
1254. 统计封闭岛屿的数目
beego开发博客系统学习(二)
对象映射 - Mapping.Mapster
1175. 质数排列 : 乘法原理运用题
R language ggplot2 visualization: use ggplot2 to visualize the scatter diagram and use scale_ x_ The log10 function configures the value range of the X axis to be logarithmic coordinates
MATLAB中polarplot函数使用
R language ggplot2 visualization: use ggplot2 to visualize the scatter diagram and use scale_ The size function configures the measurement adjustment range of the size of the data point
【云原生 | Kubernetes篇】深入了解Deployment(八)
[cf] 803 div2 A. XOR Mixup
Openmldb meetup No.4 meeting minutes
MySQL索引和优化的理解学习
Talk about how to do hardware compatibility testing and quickly migrate to openeuler?
R language ggplot2 visual Facet: gganimate package is based on Transition_ The time function creates a dynamic scatter graph animation (GIF) and uses the labs function to add a dynamic time title to t
Quel est le rôle du rétroéclairage LED?
Redis - SDS simple dynamic string
A new journey of the smart court, paperless office, escorting the green trial of the smart court
R language ggplot2 visualization: use ggplot2 visualization scatter diagram and the size parameter in AES function to specify the size of data points (point size)
Vscode select multiple words