赞
踩
今天在做ElasticSearch
进行查询的时候发现,在进行分页的时候,数据超出10000以后得页数,查询的时候会报错。后查询了es
官方文档发现,查询数量的默认值是10000
;
官网链接:https://www.elastic.co/guide/en/elasticsearch/reference/7.8/index-modules.html#dynamic-index-settings
index.max_result_window
The maximum value of from + size for searches to this index. Defaults to 10000.
Search requests take heap memory and time proportional to from + size and this limits that memory.
See Scroll or Search After for a more efficient alternative to raising this.
报错内容:
max_result_window is too large
Kibana
中进行修改,将index_name
替换成自己的索引名// 请求
PUT index_name/_settings
{
"index" : {
"max_result_window" : 200000
}
}
// 响应
{ "acknowledged": true }
curl -H "Content-Type: application/json" -XPUT 127.0.0.1:9200/index_name/_settings -d '{"index.max_result_window":"200000"}'
// 请求
GET index_name/_settings
// 响应
{
"index_name" : {
"settings" : {
"index" : {
......
"max_result_window" : "200000", // 修改后的最大限制数量
......
}
}
}
}
es
最大限制数量为10000
,所以在进行聚合分组(Aggregations )的时候,也会有限制影响,但是需要单独修改// 请求 PUT /_cluster/settings { "persistent": { "search.max_buckets": 300000 } } // 响应 { "acknowledged" : true, "persistent" : { "search" : { "max_buckets" : "300000" } }, "transient" : { } }
size
值的时候,就可以突破上限了。后续会持续更新在工作当中遇到的问题!!!
大家一起学习!!!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。