elasticsearch를 사용하여 페이지 조회를 할 때, 조회 기록이 10000시간을 초과하면 오류가 발생합니다

4416 단어 elasticsearch
elasticsearch를 사용하여 페이지별 조회를 할 때 조회 기록이 10000을 넘었을 때, 예를 들어 나는 페이지당 100개의 데이터를 사용했는데 100페이지는 문제가 없고 101페이지는 잘못 보고했다.예를 들어 페이지당 50개의 데이터는 200페이지는 문제없고 201페이지는 틀렸으며 다음과 같은 오류를 보고할 수 있다.
org.elasticsearch.action.search.SearchPhaseExecutionException: all shards failed
    at org.elasticsearch.action.search.AbstractSearchAsyncAction.onInitialPhaseResult(AbstractSearchAsyncAction.java:223) ~[elasticsearch-5.6.8.jar:5.6.8]
    at org.elasticsearch.action.search.AbstractSearchAsyncAction.access$100(AbstractSearchAsyncAction.java:58) ~[elasticsearch-5.6.8.jar:5.6.8]
    at org.elasticsearch.action.search.AbstractSearchAsyncAction$1.onFailure(AbstractSearchAsyncAction.java:148) ~[na:na]
    at org.elasticsearch.action.ActionListenerResponseHandler.handleException(ActionListenerResponseHandler.java:51) ~[elasticsearch-5.6.8.jar:5.6.8]
    at org.elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleException(TransportService.java:1032) ~[elasticsearch-5.6.8.jar:5.6.8]
    at org.elasticsearch.transport.TransportService$DirectResponseChannel.processException(TransportService.java:1134) ~[elasticsearch-5.6.8.jar:5.6.8]
    at org.elasticsearch.transport.TransportService$DirectResponseChannel.sendResponse(TransportService.java:1112) ~[elasticsearch-5.6.8.jar:5.6.8]
    at org.elasticsearch.transport.TransportService$7.onFailure(TransportService.java:629) ~[elasticsearch-5.6.8.jar:5.6.8]
    at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.onFailure(ThreadContext.java:623) ~[elasticsearch-5.6.8.jar:5.6.8]
    at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:39) ~[elasticsearch-5.6.8.jar:5.6.8]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_201]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_201]
    at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_201]
Caused by: org.elasticsearch.transport.RemoteTransportException: [es-xh-1][192.168.5.57:9300][indices:data/read/search[phase/dfs]]
Caused by: org.elasticsearch.search.query.QueryPhaseExecutionException: Result window is too large, from + size must be less than or equal to: [10000] but was [195900]. 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:202) ~[elasticsearch-5.6.8.jar:5.6.8]
    at org.elasticsearch.search.query.QueryPhase.preProcess(QueryPhase.java:90) ~[elasticsearch-5.6.8.jar:5.6.8]
    at org.elasticsearch.search.SearchService.createContext(SearchService.java:480) ~[elasticsearch-5.6.8.jar:5.6.8]
    at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:444) ~[elasticsearch-5.6.8.jar:5.6.8]
    at org.elasticsearch.search.SearchService.executeDfsPhase(SearchService.java:221) ~[elasticsearch-5.6.8.jar:5.6.8]
    at org.elasticsearch.action.search.SearchTransportService$5.messageReceived(SearchTransportService.java:320) ~[elasticsearch-5.6.8.jar:5.6.8]
    at org.elasticsearch.action.search.SearchTransportService$5.messageReceived(SearchTransportService.java:317) ~[elasticsearch-5.6.8.jar:5.6.8]
    at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-5.6.8.jar:5.6.8]
    at org.elasticsearch.transport.TransportService$7.doRun(TransportService.java:618) ~[elasticsearch-5.6.8.jar:5.6.8]
    at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:638) ~[elasticsearch-5.6.8.jar:5.6.8]
    at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-5.6.8.jar:5.6.8]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_201]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_201]
    at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_201]

솔루션: 첫 번째: curl-XPUThttp://127.0.0.1:9200/_settings -d '{ "index": { "max_result_window": 100000000}}‘
두 번째: config/elasticsearch.yml 파일의 마지막에 index를 추가합니다.max_result_윈도우: 100000000, 하지만 이런 방법은 맨 앞에 빈칸을 넣는 것을 주의해야 한다

좋은 웹페이지 즐겨찾기