1 修改 max_result_window
1.1 概述
Elasticsearch默认max_result_window的值是10000,既然都用到Elasticsearch,那么我们的数据就会远远超过这个值,这时候,我们在查询时,就会报错,提示我们:
Caused by: ElasticsearchException[Elasticsearch exception [type=illegal_argument_exception, reason=Result window is too large, from + size must be less than or equal to: [10000] but was [1253670]. See the scroll api for a more efficient way to request lar
我们只需要将max_result_window的值改大一些,就就可以了。
1.2 修改方式
PUT http://192.168.3.200:9200/索引/_settings
Content-Type application/json
参数:
{"index.max_result_window": 目标数}
响应:
{"acknowledged": true}
1.3 验证修改结果
GET http://192.168.3.200:9200/索引/_settings
响应:
{"spring-boot-elasticsearch-sample-phone": {"settings": {"index": {"refresh_interval": "1s","number_of_shards": "1","provided_name": "spring-boot-elasticsearch-sample-phone","max_result_window": "1000000000","creation_date": "1594224321383","store": {"type": "fs"},"number_of_replicas": "1","uuid": "pbgehnfyQcanClWPM40QiA","version": {"created": "7070099"}}}}}
