easy-es插入大数据报错 Connection is closed

easy-es报错描述 

Caused by: java.lang.reflect.InvocationTargetException: null
	at sun.reflect.GeneratedMethodAccessor198.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.dromara.easyes.core.proxy.EsMapperProxy$PlainMethodInvoker.invoke(EsMapperProxy.java:130)
	at org.dromara.easyes.core.proxy.EsMapperProxy.invoke(EsMapperProxy.java:75)
	... 112 common frames omitted
Caused by: org.dromara.easyes.common.exception.EasyEsException: bulkRequest exception
	at org.dromara.easyes.common.utils.ExceptionUtils.eee(ExceptionUtils.java:28)
	at org.dromara.easyes.core.kernel.BaseEsMapperImpl.doBulkRequest(BaseEsMapperImpl.java:1554)
	at org.dromara.easyes.core.kernel.BaseEsMapperImpl.doInsertBatch(BaseEsMapperImpl.java:763)
	at org.dromara.easyes.core.kernel.BaseEsMapperImpl.lambda$insertBatch$9(BaseEsMapperImpl.java:401)
	at java.util.stream.ReferencePipeline$4$1.accept(ReferencePipeline.java:210)
	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.IntPipeline.reduce(IntPipeline.java:457)
	at java.util.stream.IntPipeline.sum(IntPipeline.java:415)
	at org.dromara.easyes.core.kernel.BaseEsMapperImpl.insertBatch(BaseEsMapperImpl.java:402)
	at org.dromara.easyes.core.kernel.BaseEsMapperImpl.insertBatch(BaseEsMapperImpl.java:369)
	... 117 common frames omitted
Caused by: org.apache.http.ConnectionClosedException: Connection is closed
	at org.elasticsearch.client.RestClient.extractAndWrapCause(RestClient.java:871)
	at org.elasticsearch.client.RestClient.performRequest(RestClient.java:283)
	at org.elasticsearch.client.RestClient.performRequest(RestClient.java:270)
	at org.elasticsearch.client.RestHighLevelClient.performClientRequest(RestHighLevelClient.java:2082)
	at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1732)

解决方案以及原因

分词器只使用IK分词器

加大超时时间

  keep-alive-millis: 30000 # 心跳策略时间 单位:ms
  connect-timeout: 10000 # 连接超时时间 单位:ms,增大连接超时时间以应对高延迟的网络环境
  socket-timeout: 1200000 # 通信超时时间 单位:ms
  request-timeout: 1200000 # 请求超时时间 单位:ms,增大请求超时时间以应对大数据量的请求
  connection-request-timeout: 10000 # 连接请求超时时间 单位:ms,增大连接请求超时时间以减少连接等待

上一篇:Java实战入门:深入解析Java中的 `Arrays.sort` 方法-四、示例代码


下一篇:CondaSSLError: OpenSSL appears to be unavailable on this machine.