由於前端沒有從Es請求到數據,用postman測試接口是否有問題,結果報錯:Result window is too large, from + size must be less than or equal to: [10000] but was [13314300]。
這是因爲用Elasticsearch做分頁查詢時,Es查詢結果集默認是10000,結果集大小是int,最大爲21億左右(2^32 - 1),將窗口的最大結果集設置爲20億就可以了。
使用head插件設置方法如下圖所示:
http://ip:9200
索引名稱/_settings?preserve_existing=true,選擇PUT
{"max_result_window":2000000000}
提交請求,出現{"acknowledged": true} ,則說明修改成功。