美文网首页
ES分页超过10000行报错

ES分页超过10000行报错

作者: 机灵鬼鬼 | 来源:发表于2022-03-29 19:23 被阅读0次

    深度分页问题异常:

    org.springframework.data.elasticsearch.UncategorizedElasticsearchException: Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]; nested exception is ElasticsearchStatusException[Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]]; nested: 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 [10020]. 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.]]; nested: 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 [10020]. 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.]]
    

    处理方法:扩大max_result_window的,缺点,会增大es的cup和内存压力,容易引起oom。

    PUT 索引名/_settings
    {
      "index":{
        "max_result_window":100000
      }
    }
    

    相关文章

      网友评论

          本文标题:ES分页超过10000行报错

          本文链接:https://www.haomeiwen.com/subject/kolbjrtx.html