查询ES数据返回错误:
{"root_cause":[{"type":"illegal_argument_exception","reason":"Result window is too large, from + size must be less than or equal to: [10000] but was [999999]. See the scroll api for a more efficient way to request large data sets. This limit can be set by cha
nging the [index.max_result_window] index level setting."}
非法参数异常,结果窗口太大,from+大小必须小于或等于:[10000],但为[999999]。有关请求大型数据集的更有效方法,请参阅滚动api。此限制可由cha设置
调整[index.max_result_window]索引级别设置。
方法一
设置:max_result_window参数
请求方式:PUT
请求地址:http://localhost:9200/index-2023-08/_search
参数:
{
"max_result_window": "10000000"
}
返回结果:
{
"acknowledged": true
}
方法二
创建索引时候添加参数
"settings":{
"index":{
"max_result_window":1000000
}
}
创建索引完整参数
{
"settings": {
"index.max_result_window": 1000000,
"index.number_of_replicas": 1,
"index.number_of_shards": 1
},
"mappings": {
"properties": {
"title": {
"type": "text"
},
"name": {
"type": "text"
},
"description": {
"type": "text"
},
"create_time": {
"type": "keyword"
},
"time_stamp": {
"type": "keyword"
},
"created_user": {
"type": "date"
}
}
}
}