ES查询出现下面错误:
Caused by: org.elasticsearch.search.query.QueryPhaseExecutionException: Result window is too large, from + size must be less than or equal to: [10000] but was [1346010]. 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:203) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.search.query.QueryPhase.preProcess(QueryPhase.java:90) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.search.SearchService.createContext(SearchService.java:493) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:457) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:253) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.action.search.SearchTransportService$6.messageReceived(SearchTransportService.java:330) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.action.search.SearchTransportService$6.messageReceived(SearchTransportService.java:327) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.transport.TransportService$7.doRun(TransportService.java:644) [elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:638) [elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-5.5.2.jar:5.5.2]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_101]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_101]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_101]
[2017-10-24T10:23:38,573][DEBUG][o.e.a.s.TransportSearchAction] [node-71] All shards failed for phase: [query]
看到ES提示我结果窗口太大了,目前最大值为10000,而我却要求给我1346010。并且在后面也提到了要求我修改index.max_result_window参数来增大结果窗口大小。
在head中执行下面代码即可。
注意:events是我的索引别名。
执行完后再ES上会有如下显示:
[2017-10-24T10:27:57,168][INFO ][o.e.c.s.IndexScopedSettings] [node-71] updating [index.max_result_window] from [10000] to [100000000]
[2017-10-24T10:27:57,169][INFO ][o.e.c.s.IndexScopedSettings] [node-71] updating [index.max_rescore_window] from [10000] to [100000000]
[2017-10-24T10:27:57,185][INFO ][o.e.c.s.IndexScopedSettings] [node-71] updating [index.max_result_window] from [10000] to [100000000]
[2017-10-24T10:27:57,188][INFO ][o.e.c.s.IndexScopedSettings] [node-71] updating [index.max_rescore_window] from [10000] to [100000000]
[2017-10-24T10:27:57,199][INFO ][o.e.c.s.IndexScopedSettings] [node-71] updating [index.max_result_window] from [10000] to [100000000]
[2017-10-24T10:27:57,199][INFO ][o.e.c.s.IndexScopedSettings] [node-71] updating [index.max_rescore_window] from [10000] to [100000000]
[2017-10-24T10:27:57,209][INFO ][o.e.c.s.IndexScopedSettings] [node-71] updating [index.max_result_window] from [10000] to [100000000]
[2017-10-24T10:27:57,211][INFO ][o.e.c.s.IndexScopedSettings] [node-71] updating [index.max_rescore_window] from [10000] to [100000000]
[2017-10-24T10:27:57,218][INFO ][o.e.c.s.IndexScopedSettings] [node-71] updating [index.max_result_window] from [10000] to [100000000]
[2017-10-24T10:27:57,222][INFO ][o.e.c.s.IndexScopedSettings] [node-71] updating [index.max_rescore_window] from [10000] to [100000000]
[2017-10-24T10:27:57,231][INFO ][o.e.c.s.IndexScopedSettings] [node-71] updating [index.max_result_window] from [10000] to [100000000]
[2017-10-24T10:27:57,234][INFO ][o.e.c.s.IndexScopedSettings] [node-71] updating [index.max_rescore_window] from [10000] to [100000000]
[2017-10-24T10:27:57,239][INFO ][o.e.c.s.IndexScopedSettings] [node-71] updating [index.max_result_window] from [10000] to [100000000]
[2017-10-24T10:27:57,239][INFO ][o.e.c.s.IndexScopedSettings] [node-71] updating [index.max_rescore_window] from [10000] to [100000000]
[2017-10-24T10:27:57,241][INFO ][o.e.c.s.IndexScopedSettings] [node-71] updating [index.max_result_window] from [10000] to [100000000]
[2017-10-24T10:27:57,242][INFO ][o.e.c.s.IndexScopedSettings] [node-71] updating [index.max_rescore_window] from [10000] to [100000000]
[2017-10-24T10:27:57,243][INFO ][o.e.c.s.IndexScopedSettings] [node-71] updating [index.max_result_window] from [10000] to [100000000]
[2017-10-24T10:27:57,249][INFO ][o.e.c.s.IndexScopedSettings] [node-71] updating [index.max_rescore_window] from [10000] to [100000000]
[2017-10-24T10:27:57,250][INFO ][o.e.c.s.IndexScopedSettings] [node-71] updating [index.max_result_window] from [10000] to [100000000]
[2017-10-24T10:27:57,251][INFO ][o.e.c.s.IndexScopedSettings] [node-71] updating [index.max_rescore_window] from [10000] to [100000000]
[2017-10-24T10:27:57,252][INFO ][o.e.c.s.IndexScopedSettings] [node-71] updating [index.max_result_window] from [10000] to [100000000]
[2017-10-24T10:27:57,252][INFO ][o.e.c.s.IndexScopedSettings] [node-71] updating [index.max_rescore_window] from [10000] to [100000000]
[2017-10-24T10:27:57,254][INFO ][o.e.c.s.IndexScopedSettings] [node-71] updating [index.max_result_window] from [10000] to [100000000]
[2017-10-24T10:27:57,254][INFO ][o.e.c.s.IndexScopedSettings] [node-71] updating [index.max_rescore_window] from [10000] to [100000000]
版权声明:本文为enterys原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。