ES查询时只能查询10000条数据解决方案
ES查询时只能查询10000条数据解决方案
·
方法1:
在restful请求时,解除索引最大查询数的限制
put _all/_settings
{
"index.max_result_window":200000
}
_all表示所有索引,如果针对单个索引的话修改成索引名称即可!!!
# 修改索引查询最大只能返回10000条数据的限制, 此时修改为300万。
PUT grade/_settings
{
"index.max_result_window": 3000000
}
此时变可以查询300万条数据了,数据量太大可能存在超时问题,查询数据时加上超时参数。
方法2:
在创建索引的时候加上
{
"settings": {
"index": {
"max_result_window": 10000000000
}
}
}
方法3:
在查询时候把 track_total_hits 设置为 true。track_total_hits 设置为false禁用跟踪匹配查询的总点击次数,设置为true就会返回真实的命中条数
GET 索引名/_search
{
"query": {
"match_all": {}
},
"track_total_hits": true
}
# 查看数据
GET /grade3/_search
{
"query": {
"match_all": {}
},
"track_total_hits": true
}
# 查看数据
GET /grade/_search
{
"query": {
"match_all": {}
},
"track_total_hits": false
}
方法4:
使用kibana修改index信息
参考博文:
Elasticsearch解决只能查询10000条数据以及查询的total为10000条的解决方案_天龙至尊的博客-CSDN博客_elasticsearch查询超过10000
更多推荐
已为社区贡献40条内容
所有评论(0)