{
  "id": "elasticsearch/max-clause-count-exceeded",
  "signature": "QueryPhaseExecutionException: Result window is too large, from + size must be less than or equal to: [10000] but was [50000]",
  "signature_zh": "查询阶段执行异常：结果窗口过大，from + size 必须小于等于 [10000]，但实际为 [50000]",
  "regex": "QueryPhaseExecutionException: Result window is too large, from \\+ size must be less than or equal to: \\[\\d+\\] but was \\[\\d+\\]",
  "domain": "elasticsearch",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "The combination of 'from' and 'size' parameters in a search request exceeds the 'index.max_result_window' setting, causing query execution to fail.",
  "root_cause_type": "generic",
  "root_cause_zh": "搜索请求中 'from' 和 'size' 参数的组合超过了 'index.max_result_window' 设置，导致查询执行失败。",
  "versions": [
    {
      "version": "elasticsearch 7.17",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "elasticsearch 8.11",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "elasticsearch 8.12",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Excessive increase can cause severe memory pressure and OOM on coordinating nodes, especially with deep pagination.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Scroll is designed for deep pagination but not for random access; it requires maintaining context and doesn't support from+size directly.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This suppresses total hit count but doesn't resolve the from+size limit; the error persists if from+size still exceeds max_result_window.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use search_after with sort to implement cursor-based pagination, avoiding from+size limits. Example: POST /my_index/_search { \"size\": 10, \"sort\": [ { \"date\": \"asc\" } ], \"search_after\": [ \"2024-01-01T00:00:00\" ] }",
      "success_rate": 0.9,
      "how": "Use search_after with sort to implement cursor-based pagination, avoiding from+size limits. Example: POST /my_index/_search { \"size\": 10, \"sort\": [ { \"date\": \"asc\" } ], \"search_after\": [ \"2024-01-01T00:00:00\" ] }",
      "condition": "",
      "sources": []
    },
    {
      "action": "Temporarily increase index.max_result_window on the specific index: PUT /my_index/_settings { \"index.max_result_window\": 50000 }",
      "success_rate": 0.8,
      "how": "Temporarily increase index.max_result_window on the specific index: PUT /my_index/_settings { \"index.max_result_window\": 50000 }",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use point-in-time (PIT) with search_after for stable deep pagination in ES 7.10+: POST /my_index/_pit?keep_alive=1m then POST /_search { \"pit\": { \"id\": \"...\", \"keep_alive\": \"1m\" }, \"size\": 100, \"sort\": [ { \"_shard_doc\": \"asc\" } ], \"search_after\": [ ... ] }",
      "success_rate": 0.95,
      "how": "Use point-in-time (PIT) with search_after for stable deep pagination in ES 7.10+: POST /my_index/_pit?keep_alive=1m then POST /_search { \"pit\": { \"id\": \"...\", \"keep_alive\": \"1m\" }, \"size\": 100, \"sort\": [ { \"_shard_doc\": \"asc\" } ], \"search_after\": [ ... ] }",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "使用 search_after 配合排序实现基于游标的分页，避免 from+size 限制。示例：POST /my_index/_search { \"size\": 10, \"sort\": [ { \"date\": \"asc\" } ], \"search_after\": [ \"2024-01-01T00:00:00\" ] }",
    "临时提高特定索引的 index.max_result_window：PUT /my_index/_settings { \"index.max_result_window\": 50000 }",
    "在 ES 7.10+ 中使用 point-in-time (PIT) 和 search_after 实现稳定的深度分页：POST /my_index/_pit?keep_alive=1m 然后 POST /_search { \"pit\": { \"id\": \"...\", \"keep_alive\": \"1m\" }, \"size\": 100, \"sort\": [ { \"_shard_doc\": \"asc\" } ], \"search_after\": [ ... ] }"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-from-size.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2024-03-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}