ES搜索时报错如下,如何解决????

Elasticsearch | 作者 Aruen | 发布于2019年03月14日 | 阅读数:235

Caused by: org.apache.lucene.search.BooleanQuery$TooManyClauses: maxClauseCount is set to 1024
at org.apache.lucene.search.BooleanQuery$Builder.add(BooleanQuery.java:136) ~[lucene-core-6.3.0.jar:6.3.0 a66a44513ee8191e25b477372094bfa846450316 - shalin - 2016-11-02 19:47:11]
at org.apache.lucene.search.BooleanQuery$Builder.add(BooleanQuery.java:124) ~[lucene-core-6.3.0.jar:6.3.0 a66a44513ee8191e25b477372094bfa846450316 - shalin - 2016-11-02 19:47:11]
at org.elasticsearch.index.query.BoolQueryBuilder.addBooleanClauses(BoolQueryBuilder.java:442) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.index.query.BoolQueryBuilder.doToQuery(BoolQueryBuilder.java:411) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.index.query.AbstractQueryBuilder.toQuery(AbstractQueryBuilder.java:97) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.index.query.AbstractQueryBuilder.toFilter(AbstractQueryBuilder.java:119) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.index.query.BoolQueryBuilder.addBooleanClauses(BoolQueryBuilder.java:439) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.index.query.BoolQueryBuilder.doToQuery(BoolQueryBuilder.java:412) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.index.query.AbstractQueryBuilder.toQuery(AbstractQueryBuilder.java:97) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.index.query.QueryShardContext.lambda$toQuery$1(QueryShardContext.java:306) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.index.query.QueryShardContext.toQuery(QueryShardContext.java:323) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.index.query.QueryShardContext.toQuery(QueryShardContext.java:305) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.search.SearchService.parseSource(SearchService.java:692) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.search.SearchService.createContext(SearchService.java:553) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:529) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.search.SearchService.executeDfsPhase(SearchService.java:233) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.action.search.SearchTransportService$5.messageReceived(SearchTransportService.java:291) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.action.search.SearchTransportService$5.messageReceived(SearchTransportService.java:288) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.transport.TransportService$6.doRun(TransportService.java:577) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:527) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-5.1.1.jar:5.1.1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_111]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_111]
at java.lang.Thread.run(Thread.java:745) ~[?:1.8.0_111]
[2019-03-14T13:00:44,715][WARN ][o.e.m.j.JvmGcMonitorService] [32zHDET] [gc][293] overhead, spent [1.9s] collecting in the last [2s]
[2019-03-14T13:00:47,632][WARN ][o.e.m.j.JvmGcMonitorService] [32zHDET] [gc][294] overhead, spent [2.7s] collecting in the last [2.9s]
[2019-03-14T13:00:49,591][WARN ][o.e.m.j.JvmGcMonitorService] [32zHDET] [gc][295] overhead, spent [1.8s] collecting in the last [1.9s]
[2019-03-14T13:00:52,345][WARN ][o.e.m.j.JvmGcMonitorService] [32zHDET] [gc][296] overhead, spent [2.7s] collecting in the last [2.7s]
[2019-03-14T13:00:54,278][WARN ][o.e.m.j.JvmGcMonitorService] [32zHDET] [gc][297] overhead, spent [1.8s] collecting in the last [1.9s]
[2019-03-14T13:01:08,987][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [] fatal error in thread [elasticsearch[32zHDET][search][T#7]], exiting
java.lang.OutOfMemoryError: Java heap space
at org.elasticsearch.common.util.AbstractBigArray.newBytePage(AbstractBigArray.java:115) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.common.util.BigByteArray.resize(BigByteArray.java:141) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.common.util.BigArrays.resizeInPlace(BigArrays.java:438) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.common.util.BigArrays.resize(BigArrays.java:485) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.common.util.BigArrays.grow(BigArrays.java:502) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.common.io.stream.BytesStreamOutput.ensureCapacity(BytesStreamOutput.java:158) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.common.io.stream.BytesStreamOutput.writeBytes(BytesStreamOutput.java:90) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.common.io.stream.StreamOutput.writeBytes(StreamOutput.java:119) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.common.io.stream.StreamOutput.writeString(StreamOutput.java:332) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.common.io.stream.StreamOutput.writeOptionalString(StreamOutput.java:257) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.ElasticsearchException.writeTo(ElasticsearchException.java:207) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.index.query.QueryShardException.writeTo(QueryShardException.java:70) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.common.io.stream.StreamOutput.writeException(StreamOutput.java:812) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.action.search.ShardSearchFailure.writeTo(ShardSearchFailure.java:151) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.action.search.SearchPhaseExecutionException.writeTo(SearchPhaseExecutionException.java:65) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.common.io.stream.StreamOutput.writeException(StreamOutput.java:812) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.ElasticsearchException.writeTo(ElasticsearchException.java:208) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.transport.ActionTransportException.writeTo(ActionTransportException.java:64) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.common.io.stream.StreamOutput.writeException(StreamOutput.java:812) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.transport.TcpTransport.sendErrorResponse(TcpTransport.java:1001) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.transport.TcpTransportChannel.sendResponse(TcpTransportChannel.java:76) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.transport.DelegatingTransportChannel.sendResponse(DelegatingTransportChannel.java:68) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.transport.RequestHandlerRegistry$TransportChannelWrapper.sendResponse(RequestHandlerRegistry.java:123) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.action.support.HandledTransportAction$TransportHandler$1.onFailure(HandledTransportAction.java:77) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.action.support.TransportAction$FilteredActionListener.onFailure(TransportAction.java:245) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.action.search.AbstractSearchAsyncAction.raiseEarlyFailure(AbstractSearchAsyncAction.java:298) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.action.search.AbstractSearchAsyncAction.onFirstPhaseResult(AbstractSearchAsyncAction.java:204) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.action.search.AbstractSearchAsyncAction$1.onFailure(AbstractSearchAsyncAction.java:139) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.action.ActionListenerResponseHandler.handleException(ActionListenerResponseHandler.java:51) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleException(TransportService.java:984) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.transport.TransportService$DirectResponseChannel.processException(TransportService.java:1091) ~[elasticsearch-5.1.1.jar:5.1.1]
at org.elasticsearch.transport.TransportService$DirectResponseChannel.sendResponse(TransportService.java:1069) ~[elasticsearch-5.1.1.jar:5.1.1]
已邀请:

Aruen - 90后IT男

赞同来自:

解决方式在配置文件 Elasticsearch.yuml中配置
indices.query.bool.max_clause_count: 10240 
设置最大限制bool查询的条数。过多会导致性能比较慢

要回复问题请先登录注册