org.elasticsearch.ElasticsearchStatusException: Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]
Caused by: org.elasticsearch.client.ResponseException: method [POST], host [http://...:], URI [//****/_search?typed_keys=true&ignore_unavailable=false&expand_wildcards=open&allow_no_indices=true&search_type=query_then_fetch&batched_reduce_size=512], status line [HTTP/1.1 500 Internal Server Error] {"error":{"root_cause":[{"type":"query_phase_execution_exception","reason":"Result window is too large, from + size must be less than or equal to: [10000] but was [100001]. 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."}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"dms-apply-info","node":"IZhu6TvHSh-jm0rinE0f2A","reason":{"type":"query_phase_execution_exception","reason":"Result window is too large, from + size must be less than or equal to: [10000] but was [100001]. 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."}}]},"status":500}
## 解决
得知这个情况,我是很震惊的,因为对ES还没有全面学习(也可以说一点都没有 bushi)。于是和一位大佬发生了如下对话(自古红蓝出CP??
>
> 富贵儿:Result window is too large, from + size must be less than or equal to: [10000] but was [100001]
>
>
> 这个是指总数据量超过10000吗?
>
>
> 大佬:分页只能10000
>
>
> 富贵儿:我看pageSize是10 耶
>
>
> 大佬:pageIndex \* pageSize <=10000
>
>
> 富贵儿:那这个也查不了多少数据呀
>
>
> 大佬:是啊,只能查前10000条
>
>
> 富贵儿:认真的?
>
>
> 大佬:我们就这么干的
>
>
> 大佬:
>
>
> 
>
>
> 富贵儿:真秀啊
>
>
> 大佬:没人反馈不够用啊
>
>
> 富贵儿:你们没有超过10000的分页需求?
>
>
> 富贵儿:这很魔幻
>
>
> 大佬:超过10000需要用scroll 滚动查询
> 大佬:不能用 from + size
>
>
> 富贵儿:拼装查询参数这里,要改一下是吧
>
>
> 大佬:emmmm完全不一样的
>
>
> 富贵儿:emmmm因为我不了解哦,先确认下,就是我们这里调用要改。但是ES是支持的,这个意思?
>
>
> 大佬:不支持,只能通过一页一页滚动去看
>
>
> 富贵儿:也就是说,目前使用ES查询,没办法查10000以后的数据,我可以这么理解不?分页查询的话,不支持查超过10000的
>
>
> 大佬:嗯
>
>
> 富贵儿:感谢解答,这个分页查询,好鸡肋的感觉
>
>
> 大佬:合理没必要查10000以后的
>
>
> 富贵儿:为啥,我这边现在就遇到了
>
>
> 大佬:没人会去翻 10000以后啊
>
>
> 富贵儿:刚刚就有人查了,线上报错了,才发现了这个问题
>
>
> 大佬:没事的,做一个提示吧
>
>