目录
大数据量分页查询报错
问题详情
在用elasticsearch-php分页查询时,分页几次后报错,错误内容如下:文章源自编程技术分享-https://mervyn.life/98dabb75.html
{
"error":{
"root_cause":[
{
"type":"query_phase_execution_exception",
"reason":"Result window is too large, from + size must be less than or equal to: [10000] but was [15000]. 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."
}
],
"type":"search_phase_execution_exception",
"reason":"all shards failed",
"phase":"query",
"grouped":true,
"failed_shards":[
{
"shard":0,
"index":"es_type",
"node":"OVgyFsCDsfqwnvXz0nqA",
"reason":{
"type":"query_phase_execution_exception",
"reason":"Result window is too large, from + size must be less than or equal to: [10000] but was [15000]. 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."
}
}
]
},
"status":500
}
解决方法
Elasticsearch 默认是有查询上限的, from + size 的值必须要小于等于 10000, 需要修改对应参数 max_result_window
的值。文章源自编程技术分享-https://mervyn.life/98dabb75.html
PUT http://127.0.0.1:9200/es_type/_settings -d '{ "index" : { "max_result_window" : 100000000}}'
curl 进行 PUT 或 POST 时报错
问题详情
{"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}
解决方法
elasticsearch6.x 后需要在执行 curl 命令时加入 header 头文章源自编程技术分享-https://mervyn.life/98dabb75.html
curl -H "Content-Type: application/json" -XPUT http://127.0.0.1:9200/es_type/_settings -d '
{
"index" : { "max_result_window" : 100000000}
}'
文章源自编程技术分享-https://mervyn.life/98dabb75.html 我的微信公众号
微信扫一扫
评论