美文网首页
ElasticSearch index.max_result_w

ElasticSearch index.max_result_w

作者: 谁在烽烟彼岸 | 来源:发表于2020-05-15 17:36 被阅读0次

    当用elasticsearch进行深度分页查询时的size-from大于10000的时候,就会报错“org.elasticsearch.search.query.QueryPhaseExecutionException”,

    Caused by: org.elasticsearch.search.query.QueryPhaseExecutionException: Result window is too large, from + size must be less than or equal to: [10000] but was [19998]. 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.
            at org.elasticsearch.search.DefaultSearchContext.preProcess(DefaultSearchContext.java:206) ~[elasticsearch-6.1.1.jar!/:6.1.1]
            at org.elasticsearch.search.query.QueryPhase.preProcess(QueryPhase.java:90) ~[elasticsearch-6.1.1.jar!/:6.1.1]
            at org.elasticsearch.search.SearchService.createContext(SearchService.java:564) ~[elasticsearch-6.1.1.jar!/:6.1.1]
            at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:528) ~[elasticsearch-6.1.1.jar!/:6.1.1]
            at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:324) ~[elasticsearch-6.1.1.jar!/:6.1.1]
            at org.elasticsearch.search.SearchService$2.onResponse(SearchService.java:310) ~[elasticsearch-6.1.1.jar!/:6.1.1]
            ... 9 common frames omitted
    

    解决办法有三:

    1. 对于单个索引使用
    curl -XPUT host:port/indexName/_settings -H 'Content-Type: application/json' -d '{ "index.max_result_window" :"1000000"}'
    
    1. 对于全部索引使用
    curl -XPUT host:port/_settings -H 'Content-Type: application/json' -d '{ "index.max_result_window" :"1000000"}'
    
    1. 在配置文件elasticsearch.yml中修改
    index.max_result_window: 1000000
    

    相关文章

      网友评论

          本文标题:ElasticSearch index.max_result_w

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