什么客户端配置设置最适合建立elasticsearch连接

thigvfpy  于 2021-07-24  发布在  Java
关注(0)|答案(0)|浏览(386)

对于具有以下设置的clientconfiguration,我们经常会看到以下错误。我们应该怎么做才能阻止这个超时错误的发生

withConnectTimeout = 5 seconds
withSocketTimeout = 3 seconds

Caused by: org.springframework.dao.DataAccessResourceFailureException: 5,000 milliseconds timeout on connection http-outgoing-0 [ACTIVE]; nested exception is java.lang.RuntimeException: 5,000 milliseconds timeout on connection http-outgoing-0 [ACTIVE]

        at org.springframework.data.elasticsearch.core.ElasticsearchExceptionTranslator.translateExceptionIfPossible(ElasticsearchExceptionTranslator.java:75) ~[spring-data-elasticsearch-4.2.0-M2.jar:4.2.0-M2]

        at org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate.translateException(ElasticsearchRestTemplate.java:363) ~[spring-data-elasticsearch-4.2.0-M2.jar:4.2.0-M2]

        at org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate.execute(ElasticsearchRestTemplate.java:346) ~[spring-data-elasticsearch-4.2.0-M2.jar:4.2.0-M2]

        at org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate.doExists(ElasticsearchRestTemplate.java:182) ~[spring-data-elasticsearch-4.2.0-M2.jar:4.2.0-M2]

        at org.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate.exists(AbstractElasticsearchTemplate.java:252) ~[spring-data-elasticsearch-4.2.0-M2.jar:4.2.0-M2]

        at org.springframework.data.elasticsearch.repository.support.SimpleElasticsearchRepository.lambda$existsById$9(SimpleElasticsearchRepository.java:216) ~[spring-data-elasticsearch-4.2.0-M2.jar:4.2.0-M2]

        at org.springframework.data.elasticsearch.repository.support.SimpleElasticsearchRepository.execute(SimpleElasticsearchRepository.java:401) ~[spring-data-elasticsearch-4.2.0-M2.jar:4.2.0-M2]

        at org.springframework.data.elasticsearch.repository.support.SimpleElasticsearchRepository.existsById(SimpleElasticsearchRepository.java:216) ~[spring-data-elasticsearch-4.2.0-M2.jar:4.2.0-M2]

        at jdk.internal.reflect.GeneratedMethodAccessor172.invoke(Unknown Source) ~[na:na]

        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]

        at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]

        at org.springframework.data.repository.core.support.RepositoryMethodInvoker$RepositoryFragmentMethodInvoker.lambda$new$0(RepositoryMethodInvoker.java:289) ~[spring-data-commons-2.5.0-M2.jar:2.5.0-M2]

        at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:137) ~[spring-data-commons-2.5.0-M2.jar:2.5.0-M2]

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题