1. 程式人生 > >elastic query match_all 數據目標超過10000條出錯 Result window is too large

elastic query match_all 數據目標超過10000條出錯 Result window is too large

see root more code index size efficient mit xxxxx

起因

elastic做文本索引,match_all目標索引超過10000條時,出錯

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "Result window is too large, from + size must be less than or equal to: [10000] but was [500000]. 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."
      }
    ],
    ... 省略無關 ...

嘗試

根據關鍵字Result window is too large及錯誤提示,得知需要設置目標索引[index.max_result_window]

解決

kibana直接修改(或以此格式代碼內修改)

PUT /idx_XXXXXXXXXXXXX/_settings
{
  "index": {
    "max_result_window":1000000
  }
}

elastic query match_all 數據目標超過10000條出錯 Result window is too large