# How to avoid 30,000ms timeout during reindexing

**URL:** <https://discuss.elastic.co/t/how-to-avoid-30-000ms-timeout-during-reindexing/231370>\
**Category:** Elasticsearch\
**Created:** [May 6, 2020, 3:09pm UTC](https://discuss.elastic.co/t/how-to-avoid-30-000ms-timeout-during-reindexing/231370 "2020-05-06T15:09:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![deepak643](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/deepak643/32/45940_2.png) [@deepak643](https://discuss.elastic.co/u/deepak643)\
**Post date:** [May 6, 2020, 3:09pm UTC](https://discuss.elastic.co/t/how-to-avoid-30-000ms-timeout-during-reindexing/231370/1 "2020-05-06T15:09:56Z")

</div>

While performing reindex operation, I am setting the request timeout to be 60 mins as below

```auto
request.setTimeout(TimeValue. timeValueMinutes (60));

```

With the above config in place my request is still timing out for 30,000 ms. How can I avoid the below error

```auto
java.net.SocketTimeoutException: 30,000 milliseconds timeout on connection http-outgoing-0

```

---

<div class="post-metadata">

**Author:** ![deepak643](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/deepak643/32/45940_2.png) [@deepak643](https://discuss.elastic.co/u/deepak643)\
**Post date:** [May 6, 2020, 6:27pm UTC](https://discuss.elastic.co/t/how-to-avoid-30-000ms-timeout-during-reindexing/231370/2 "2020-05-06T18:27:14Z")

</div>

After debugging enough, Came to know that socketTimeout should be set during client creation time and request timeout is something completely different from socketTimeout.

I started setting socketTimeout as below and worked fine.

```auto
return new RestHighLevelClient( RestClient.builder( HttpHost
                                                            .create( elasticSearchConfig().getEndPoint() ) )
                                        .setHttpClientConfigCallback( hacb -> hacb.addInterceptorLast( interceptor ) ) 
                                        .setRequestConfigCallback(requestConfigBuilder -> requestConfigBuilder.setConnectTimeout(elasticSearchConfig().getClientConnectionTimeout())
                                                .setSocketTimeout(elasticSearchConfig().getClientSocketTimeout())));

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 3, 2020, 6:27pm UTC](https://discuss.elastic.co/t/how-to-avoid-30-000ms-timeout-during-reindexing/231370/3 "2020-06-03T18:27:14Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
