# SocketTimeoutException while using JEST to connect to ES

**URL:** <https://discuss.elastic.co/t/sockettimeoutexception-while-using-jest-to-connect-to-es/18320>\
**Category:** Elasticsearch\
**Created:** [June 25, 2014, 8:23am UTC](https://discuss.elastic.co/t/sockettimeoutexception-while-using-jest-to-connect-to-es/18320 "2014-06-25T08:23:28Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![anuj\_maheshwari](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@anuj\_maheshwari](https://discuss.elastic.co/u/anuj_maheshwari)\
**Post date:** [June 25, 2014, 8:23am UTC](https://discuss.elastic.co/t/sockettimeoutexception-while-using-jest-to-connect-to-es/18320/1 "2014-06-25T08:23:28Z")

</div>

Hi,

I am evaluating Log Stash and Elastic Search for one of our requirement. I  
have to query data from Elastic Search in a Java Application. I am trying  
to use JEST to make a HTTP/REST call to ES. When I am trying to add a  
simple index in ES using Jest Client, I am  
getting "java.net.SocketTimeoutException: Read timed out" exception at the  
time of client execute statement.

```
    HttpClientConfig clientConfig = new 

```

HttpClientConfig.Builder("http://My\_Host:9200").readTimeout(20000).multiThreaded(true).build();  
JestClientFactory factory = new JestClientFactory();  
factory.setHttpClientConfig(clientConfig);

```
    JestHttpClient jestClient = (JestHttpClient) factory.getObject();

```

- 

```
   jestClient.execute(new CreateIndex.Builder("myIndex").build()); // 

```

Here I am getting Socket Read Timeout Exception.\*

Below is the full error stack trace -

Exception in thread "main" java.net.SocketTimeoutException: Read timed out  
at java.net.SocketInputStream.socketRead0(Native Method)  
at java.net.SocketInputStream.read(SocketInputStream.java:150)  
at java.net.SocketInputStream.read(SocketInputStream.java:121)  
at  
org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:136)  
at  
org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:152)  
at  
org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:270)  
at  
org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:140)  
at  
org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)  
at  
org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:260)  
at  
org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:161)  
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
at  
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)  
at  
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
at java.lang.reflect.Method.invoke(Method.java:601)  
at org.apache.http.impl.conn.CPoolProxy.invoke(CPoolProxy.java:138)  
at com.sun.proxy.$Proxy0.receiveResponseHeader(Unknown Source)  
at  
org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:271)  
at  
org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:123)  
at  
org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:254)  
at  
org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)  
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)  
at  
org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)  
at  
org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186)  
at  
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)  
at  
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)  
at io.searchbox.client.http.JestHttpClient.execute(JestHttpClient.java:59)  
at webservice.ESClient.main(ESClient.java:50)  
Process exited with exit code 1.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/dfd99387-175c-43fb-833e-83b206ce22fd%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/dfd99387-175c-43fb-833e-83b206ce22fd%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![anuj\_maheshwari](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@anuj\_maheshwari](https://discuss.elastic.co/u/anuj_maheshwari)\
**Post date:** [June 25, 2014, 11:43am UTC](https://discuss.elastic.co/t/sockettimeoutexception-while-using-jest-to-connect-to-es/18320/2 "2014-06-25T11:43:45Z")

</div>

Any one having inputs on this?

On Wednesday, 25 June 2014 13:53:29 UTC+5:30, anuj maheshwari wrote:

> Hi,
> 
> I am evaluating Log Stash and Elastic Search for one of our requirement. I  
> have to query data from Elastic Search in a Java Application. I am trying  
> to use JEST to make a HTTP/REST call to ES. When I am trying to add a  
> simple index in ES using Jest Client, I am  
> getting "java.net.SocketTimeoutException: Read timed out" exception at the  
> time of client execute statement.
> 
> ```
> HttpClientConfig clientConfig = new HttpClientConfig.Builder("
> 
> ```
> 
> http://My\_Host:9200").readTimeout(20000).multiThreaded(true).build();  
> JestClientFactory factory = new JestClientFactory();  
> factory.setHttpClientConfig(clientConfig);
> 
> ```
> JestHttpClient jestClient = (JestHttpClient) factory.getObject();
> 
> ```
> 
> - 
> 
> ```
> jestClient.execute(new CreateIndex.Builder("myIndex").build()); 
> 
> ```
> 
> // Here I am getting Socket Read Timeout Exception.\*
> 
> Below is the full error stack trace -
> 
> Exception in thread "main" java.net.SocketTimeoutException: Read timed out  
> at java.net.SocketInputStream.socketRead0(Native Method)  
> at java.net.SocketInputStream.read(SocketInputStream.java:150)  
> at java.net.SocketInputStream.read(SocketInputStream.java:121)  
> at  
> org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:136)  
> at  
> org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:152)  
> at  
> org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:270)  
> at  
> org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:140)  
> at  
> org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)  
> at  
> org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:260)  
> at  
> org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:161)  
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
> at  
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)  
> at  
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
> at java.lang.reflect.Method.invoke(Method.java:601)  
> at org.apache.http.impl.conn.CPoolProxy.invoke(CPoolProxy.java:138)  
> at com.sun.proxy.$Proxy0.receiveResponseHeader(Unknown Source)  
> at  
> org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:271)  
> at  
> org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:123)  
> at  
> org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:254)  
> at  
> org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)  
> at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)  
> at  
> org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)  
> at  
> org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186)  
> at  
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)  
> at  
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)  
> at io.searchbox.client.http.JestHttpClient.execute(JestHttpClient.java:59)  
> at webservice.ESClient.main(ESClient.java:50)  
> Process exited with exit code 1.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/df69cde1-f433-45f3-a69f-b15e700e1b69%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/df69cde1-f433-45f3-a69f-b15e700e1b69%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Cedric\_Hourcade](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cedric_hourcade/32/1451_2.png) [@Cedric\_Hourcade](https://discuss.elastic.co/u/Cedric_Hourcade)\
**Post date:** [June 25, 2014, 11:56am UTC](https://discuss.elastic.co/t/sockettimeoutexception-while-using-jest-to-connect-to-es/18320/3 "2014-06-25T11:56:31Z")

</div>

Hello,

Does it work out of JEST, with a simple curl?

Cédric Hourcade  
[ced@wal.fr](mailto:ced@wal.fr)

On Wed, Jun 25, 2014 at 1:43 PM, anuj maheshwari  
[anujmaheshwari1984@gmail.com](mailto:anujmaheshwari1984@gmail.com) wrote:

> Any one having inputs on this?
> 
> On Wednesday, 25 June 2014 13:53:29 UTC+5:30, anuj maheshwari wrote:
> 
> > Hi,
> > 
> > I am evaluating Log Stash and Elastic Search for one of our requirement. I  
> > have to query data from Elastic Search in a Java Application. I am trying to  
> > use JEST to make a HTTP/REST call to ES. When I am trying to add a simple  
> > index in ES using Jest Client, I am getting  
> > "java.net.SocketTimeoutException: Read timed out" exception at the time of  
> > client execute statement.
> > 
> > ```
> > HttpClientConfig clientConfig = new
> > 
> > ```
> > 
> > HttpClientConfig.Builder("http://My\_Host:9200").readTimeout(20000).multiThreaded(true).build();  
> > JestClientFactory factory = new JestClientFactory();  
> > factory.setHttpClientConfig(clientConfig);
> > 
> > ```
> > JestHttpClient jestClient = (JestHttpClient) factory.getObject();
> > 
> > jestClient.execute(new CreateIndex.Builder("myIndex").build()); //
> > 
> > ```
> > 
> > Here I am getting Socket Read Timeout Exception.
> > 
> > Below is the full error stack trace -
> > 
> > Exception in thread "main" java.net.SocketTimeoutException: Read timed out  
> > at java.net.SocketInputStream.socketRead0(Native Method)  
> > at java.net.SocketInputStream.read(SocketInputStream.java:150)  
> > at java.net.SocketInputStream.read(SocketInputStream.java:121)  
> > at  
> > org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:136)  
> > at  
> > org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:152)  
> > at  
> > org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:270)  
> > at  
> > org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:140)  
> > at  
> > org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)  
> > at  
> > org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:260)  
> > at  
> > org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:161)  
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
> > at  
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)  
> > at  
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
> > at java.lang.reflect.Method.invoke(Method.java:601)  
> > at org.apache.http.impl.conn.CPoolProxy.invoke(CPoolProxy.java:138)  
> > at com.sun.proxy.$Proxy0.receiveResponseHeader(Unknown Source)  
> > at  
> > org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:271)  
> > at  
> > org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:123)  
> > at  
> > org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:254)  
> > at  
> > org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)  
> > at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)  
> > at  
> > org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)  
> > at  
> > org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186)  
> > at  
> > org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)  
> > at  
> > org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)  
> > at io.searchbox.client.http.JestHttpClient.execute(JestHttpClient.java:59)  
> > at webservice.ESClient.main(ESClient.java:50)  
> > Process exited with exit code 1.
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/df69cde1-f433-45f3-a69f-b15e700e1b69%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/df69cde1-f433-45f3-a69f-b15e700e1b69%40googlegroups.com).
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAJQxjPOjKR3hsFp046h8o4o%3DBO4n%3Dwi%3DhDBd4z%2BhEfk\_VODUiA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAJQxjPOjKR3hsFp046h8o4o%3DBO4n%3Dwi%3DhDBd4z%2BhEfk_VODUiA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![anuj\_maheshwari](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@anuj\_maheshwari](https://discuss.elastic.co/u/anuj_maheshwari)\
**Post date:** [June 25, 2014, 1:42pm UTC](https://discuss.elastic.co/t/sockettimeoutexception-while-using-jest-to-connect-to-es/18320/4 "2014-06-25T13:42:08Z")

</div>

Yes.

On Wed, Jun 25, 2014 at 5:26 PM, Cédric Hourcade [ced@wal.fr](mailto:ced@wal.fr) wrote:

> Hello,
> 
> Does it work out of JEST, with a simple curl?
> 
> Cédric Hourcade  
> [ced@wal.fr](mailto:ced@wal.fr)
> 
> On Wed, Jun 25, 2014 at 1:43 PM, anuj maheshwari  
> [anujmaheshwari1984@gmail.com](mailto:anujmaheshwari1984@gmail.com) wrote:
> 
> > Any one having inputs on this?
> > 
> > On Wednesday, 25 June 2014 13:53:29 UTC+5:30, anuj maheshwari wrote:
> > 
> > > Hi,
> > > 
> > > I am evaluating Log Stash and Elastic Search for one of our  
> > > requirement. I  
> > > have to query data from Elastic Search in a Java Application. I am  
> > > trying to  
> > > use JEST to make a HTTP/REST call to ES. When I am trying to add a  
> > > simple  
> > > index in ES using Jest Client, I am getting  
> > > "java.net.SocketTimeoutException: Read timed out" exception at the time  
> > > of  
> > > client execute statement.
> > > 
> > > ```
> > > HttpClientConfig clientConfig = new
> > > 
> > > ```
> > > 
> > > HttpClientConfig.Builder("http://My\_Host:9200  
> > > ").readTimeout(20000).multiThreaded(true).build();  
> > > JestClientFactory factory = new JestClientFactory();  
> > > factory.setHttpClientConfig(clientConfig);
> > > 
> > > ```
> > > JestHttpClient jestClient = (JestHttpClient)
> > > 
> > > ```
> 
> factory.getObject();
> 
> > > ```
> > > jestClient.execute(new CreateIndex.Builder("myIndex").build());
> > > 
> > > ```
> 
> //
> 
> > > Here I am getting Socket Read Timeout Exception.
> > > 
> > > Below is the full error stack trace -
> > > 
> > > Exception in thread "main" java.net.SocketTimeoutException: Read timed  
> > > out  
> > > at java.net.SocketInputStream.socketRead0(Native Method)  
> > > at java.net.SocketInputStream.read(SocketInputStream.java:150)  
> > > at java.net.SocketInputStream.read(SocketInputStream.java:121)  
> > > at
> 
> org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:136)
> 
> > > at
> 
> org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:152)
> 
> > > at
> 
> org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:270)
> 
> > > at
> 
> org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:140)
> 
> > > at
> 
> org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)
> 
> > > at
> 
> org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:260)
> 
> > > at
> 
> org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:161)
> 
> > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
> > > at
> 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> 
> > > at
> 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 
> > > at java.lang.reflect.Method.invoke(Method.java:601)  
> > > at org.apache.http.impl.conn.CPoolProxy.invoke(CPoolProxy.java:138)  
> > > at com.sun.proxy.$Proxy0.receiveResponseHeader(Unknown Source)  
> > > at
> 
> org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:271)
> 
> > > at
> 
> org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:123)
> 
> > > at
> 
> org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:254)
> 
> > > at
> 
> org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
> 
> > > at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)  
> > > at
> 
> org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
> 
> > > at
> 
> org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186)
> 
> > > at
> 
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
> 
> > > at
> 
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
> 
> > > at  
> > > io.searchbox.client.http.JestHttpClient.execute(JestHttpClient.java:59)  
> > > at webservice.ESClient.main(ESClient.java:50)  
> > > Process exited with exit code 1.
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit
> 
> [https://groups.google.com/d/msgid/elasticsearch/df69cde1-f433-45f3-a69f-b15e700e1b69%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/df69cde1-f433-45f3-a69f-b15e700e1b69%40googlegroups.com)  
> .
> 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/gsweC\_svK38/unsubscribe](https://groups.google.com/d/topic/elasticsearch/gsweC_svK38/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAJQxjPOjKR3hsFp046h8o4o%3DBO4n%3Dwi%3DhDBd4z%2BhEfk\_VODUiA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAJQxjPOjKR3hsFp046h8o4o%3DBO4n%3Dwi%3DhDBd4z%2BhEfk_VODUiA%40mail.gmail.com)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CACtah4q2kutdumRhsQfkno%2B80Wi5Eci8%2BGsrs46roKfFiTDqQg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CACtah4q2kutdumRhsQfkno%2B80Wi5Eci8%2BGsrs46roKfFiTDqQg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Renuka](https://avatars.discourse-cdn.com/v4/letter/r/bc8723/32.png) [@Renuka](https://discuss.elastic.co/u/Renuka)\
**Post date:** [August 2, 2014, 11:18am UTC](https://discuss.elastic.co/t/sockettimeoutexception-while-using-jest-to-connect-to-es/18320/5 "2014-08-02T11:18:29Z")

</div>

I'm facing the same issue. Using Jest 0.1.0 version. Is there any solution  
for this problem?

On Wednesday, June 25, 2014 1:53:29 PM UTC+5:30, anuj maheshwari wrote:

> Hi,
> 
> I am evaluating Log Stash and Elastic Search for one of our requirement. I  
> have to query data from Elastic Search in a Java Application. I am trying  
> to use JEST to make a HTTP/REST call to ES. When I am trying to add a  
> simple index in ES using Jest Client, I am  
> getting "java.net.SocketTimeoutException: Read timed out" exception at the  
> time of client execute statement.
> 
> ```
> HttpClientConfig clientConfig = new HttpClientConfig.Builder("
> 
> ```
> 
> http://My\_Host:9200").readTimeout(20000).multiThreaded(true).build();  
> JestClientFactory factory = new JestClientFactory();  
> factory.setHttpClientConfig(clientConfig);
> 
> ```
> JestHttpClient jestClient = (JestHttpClient) factory.getObject();
> 
> ```
> 
> - 
> 
> ```
> jestClient.execute(new CreateIndex.Builder("myIndex").build()); 
> 
> ```
> 
> // Here I am getting Socket Read Timeout Exception.\*
> 
> Below is the full error stack trace -
> 
> Exception in thread "main" java.net.SocketTimeoutException: Read timed out  
> at java.net.SocketInputStream.socketRead0(Native Method)  
> at java.net.SocketInputStream.read(SocketInputStream.java:150)  
> at java.net.SocketInputStream.read(SocketInputStream.java:121)  
> at  
> org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:136)  
> at  
> org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:152)  
> at  
> org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:270)  
> at  
> org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:140)  
> at  
> org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)  
> at  
> org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:260)  
> at  
> org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:161)  
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
> at  
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)  
> at  
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
> at java.lang.reflect.Method.invoke(Method.java:601)  
> at org.apache.http.impl.conn.CPoolProxy.invoke(CPoolProxy.java:138)  
> at com.sun.proxy.$Proxy0.receiveResponseHeader(Unknown Source)  
> at  
> org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:271)  
> at  
> org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:123)  
> at  
> org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:254)  
> at  
> org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)  
> at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)  
> at  
> org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)  
> at  
> org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186)  
> at  
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)  
> at  
> org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)  
> at io.searchbox.client.http.JestHttpClient.execute(JestHttpClient.java:59)  
> at webservice.ESClient.main(ESClient.java:50)  
> Process exited with exit code 1.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/97d349ca-f12e-4be0-85fb-c05e17ede84e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/97d349ca-f12e-4be0-85fb-c05e17ede84e%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![anuj\_maheshwari](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@anuj\_maheshwari](https://discuss.elastic.co/u/anuj_maheshwari)\
**Post date:** [August 2, 2014, 4:08pm UTC](https://discuss.elastic.co/t/sockettimeoutexception-while-using-jest-to-connect-to-es/18320/6 "2014-08-02T16:08:54Z")

</div>

My client was not able to communicate with ES server. It was a HTTP proxy  
issue. Try looking around this for your case.

On Sat, Aug 2, 2014 at 4:48 PM, Renu [renuka.g@bambeeq.com](mailto:renuka.g@bambeeq.com) wrote:

> I'm facing the same issue. Using Jest 0.1.0 version. Is there any solution  
> for this problem?
> 
> On Wednesday, June 25, 2014 1:53:29 PM UTC+5:30, anuj maheshwari wrote:
> 
> > Hi,
> > 
> > I am evaluating Log Stash and Elastic Search for one of our requirement.  
> > I have to query data from Elastic Search in a Java Application. I am trying  
> > to use JEST to make a HTTP/REST call to ES. When I am trying to add a  
> > simple index in ES using Jest Client, I am getting "java.net.SocketTimeoutException:  
> > Read timed out" exception at the time of client execute statement.
> > 
> > ```
> > HttpClientConfig clientConfig = new HttpClientConfig.Builder("
> > 
> > ```
> > 
> > http://My\_Host:9200").readTimeout(20000).multiThreaded(true).build();  
> > JestClientFactory factory = new JestClientFactory();  
> > factory.setHttpClientConfig(clientConfig);
> > 
> > ```
> > JestHttpClient jestClient = (JestHttpClient) factory.getObject();
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > jestClient.execute(new CreateIndex.Builder("myIndex").build());
> > 
> > ```
> > 
> > // Here I am getting Socket Read Timeout Exception.\*
> > 
> > Below is the full error stack trace -
> > 
> > Exception in thread "main" java.net.SocketTimeoutException: Read timed  
> > out  
> > at java.net.SocketInputStream.socketRead0(Native Method)  
> > at java.net.SocketInputStream.read(SocketInputStream.java:150)  
> > at java.net.SocketInputStream.read(SocketInputStream.java:121)  
> > at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(  
> > SessionInputBufferImpl.java:136)  
> > at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(  
> > SessionInputBufferImpl.java:152)  
> > at org.apache.http.impl.io.SessionInputBufferImpl.readLine(  
> > SessionInputBufferImpl.java:270)  
> > at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(  
> > DefaultHttpResponseParser.java:140)  
> > at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(  
> > DefaultHttpResponseParser.java:57)  
> > at org.apache.http.impl.io.AbstractMessageParser.parse(  
> > AbstractMessageParser.java:260)  
> > at org.apache.http.impl.DefaultBHttpClientConnection.  
> > receiveResponseHeader(DefaultBHttpClientConnection.java:161)  
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
> > at sun.reflect.NativeMethodAccessorImpl.invoke(  
> > NativeMethodAccessorImpl.java:57)  
> > at sun.reflect.DelegatingMethodAccessorImpl.invoke(  
> > DelegatingMethodAccessorImpl.java:43)  
> > at java.lang.reflect.Method.invoke(Method.java:601)  
> > at org.apache.http.impl.conn.CPoolProxy.invoke(CPoolProxy.java:138)  
> > at com.sun.proxy.$Proxy0.receiveResponseHeader(Unknown Source)  
> > at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(  
> > HttpRequestExecutor.java:271)  
> > at org.apache.http.protocol.HttpRequestExecutor.execute(  
> > HttpRequestExecutor.java:123)  
> > at org.apache.http.impl.execchain.MainClientExec.  
> > execute(MainClientExec.java:254)  
> > at org.apache.http.impl.execchain.ProtocolExec.  
> > execute(ProtocolExec.java:195)  
> > at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)  
> > at org.apache.http.impl.execchain.RedirectExec.  
> > execute(RedirectExec.java:108)  
> > at org.apache.http.impl.client.InternalHttpClient.doExecute(  
> > InternalHttpClient.java:186)  
> > at org.apache.http.impl.client.CloseableHttpClient.execute(  
> > CloseableHttpClient.java:82)  
> > at org.apache.http.impl.client.CloseableHttpClient.execute(  
> > CloseableHttpClient.java:106)  
> > at io.searchbox.client.http.JestHttpClient.execute(  
> > JestHttpClient.java:59)  
> > at webservice.ESClient.main(ESClient.java:50)  
> > Process exited with exit code 1.
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/gsweC\_svK38/unsubscribe](https://groups.google.com/d/topic/elasticsearch/gsweC_svK38/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to  
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/97d349ca-f12e-4be0-85fb-c05e17ede84e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/97d349ca-f12e-4be0-85fb-c05e17ede84e%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/97d349ca-f12e-4be0-85fb-c05e17ede84e%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/97d349ca-f12e-4be0-85fb-c05e17ede84e%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CACtah4oQ\_F\_nTFm%3DeFew3YMrtKN2Q1M67i\_aGJKiA1QuCOc%2BuA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CACtah4oQ_F_nTFm%3DeFew3YMrtKN2Q1M67i_aGJKiA1QuCOc%2BuA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Eitan\_Vesely](https://avatars.discourse-cdn.com/v4/letter/e/82dd89/32.png) [@Eitan\_Vesely](https://discuss.elastic.co/u/Eitan_Vesely)\
**Post date:** [August 3, 2014, 5:15pm UTC](https://discuss.elastic.co/t/sockettimeoutexception-while-using-jest-to-connect-to-es/18320/7 "2014-08-03T17:15:34Z")

</div>

Hi Im facing the same issue. can you please elaborate about yout HTTP proxy  
issue?  
or any other options??

On Saturday, August 2, 2014 7:09:30 PM UTC+3, anuj maheshwari wrote:

> My client was not able to communicate with ES server. It was a HTTP proxy  
> issue. Try looking around this for your case.
> 
> On Sat, Aug 2, 2014 at 4:48 PM, Renu \<[renu...@bambeeq.com](mailto:renu...@bambeeq.com) \<javascript:\>\>  
> wrote:
> 
> > I'm facing the same issue. Using Jest 0.1.0 version. Is there any  
> > solution for this problem?
> > 
> > On Wednesday, June 25, 2014 1:53:29 PM UTC+5:30, anuj maheshwari wrote:
> > 
> > > Hi,
> > > 
> > > I am evaluating Log Stash and Elastic Search for one of our requirement.  
> > > I have to query data from Elastic Search in a Java Application. I am trying  
> > > to use JEST to make a HTTP/REST call to ES. When I am trying to add a  
> > > simple index in ES using Jest Client, I am getting "java.net.SocketTimeoutException:  
> > > Read timed out" exception at the time of client execute statement.
> > > 
> > > ```
> > > HttpClientConfig clientConfig = new HttpClientConfig.Builder("
> > > 
> > > ```
> > > 
> > > http://My\_Host:9200").readTimeout(20000).multiThreaded(true).build();  
> > > JestClientFactory factory = new JestClientFactory();  
> > > factory.setHttpClientConfig(clientConfig);
> > > 
> > > ```
> > > JestHttpClient jestClient = (JestHttpClient) factory.getObject();
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > jestClient.execute(new CreateIndex.Builder("myIndex").build()); 
> > > 
> > > ```
> > > 
> > > // Here I am getting Socket Read Timeout Exception.\*
> > > 
> > > Below is the full error stack trace -
> > > 
> > > Exception in thread "main" java.net.SocketTimeoutException: Read timed  
> > > out  
> > > at java.net.SocketInputStream.socketRead0(Native Method)  
> > > at java.net.SocketInputStream.read(SocketInputStream.java:150)  
> > > at java.net.SocketInputStream.read(SocketInputStream.java:121)  
> > > at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(  
> > > SessionInputBufferImpl.java:136)  
> > > at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(  
> > > SessionInputBufferImpl.java:152)  
> > > at org.apache.http.impl.io.SessionInputBufferImpl.readLine(  
> > > SessionInputBufferImpl.java:270)  
> > > at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(  
> > > DefaultHttpResponseParser.java:140)  
> > > at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(  
> > > DefaultHttpResponseParser.java:57)  
> > > at org.apache.http.impl.io.AbstractMessageParser.parse(  
> > > AbstractMessageParser.java:260)  
> > > at org.apache.http.impl.DefaultBHttpClientConnection.  
> > > receiveResponseHeader(DefaultBHttpClientConnection.java:161)  
> > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
> > > at sun.reflect.NativeMethodAccessorImpl.invoke(  
> > > NativeMethodAccessorImpl.java:57)  
> > > at sun.reflect.DelegatingMethodAccessorImpl.invoke(  
> > > DelegatingMethodAccessorImpl.java:43)  
> > > at java.lang.reflect.Method.invoke(Method.java:601)  
> > > at org.apache.http.impl.conn.CPoolProxy.invoke(CPoolProxy.java:138)  
> > > at com.sun.proxy.$Proxy0.receiveResponseHeader(Unknown Source)  
> > > at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(  
> > > HttpRequestExecutor.java:271)  
> > > at org.apache.http.protocol.HttpRequestExecutor.execute(  
> > > HttpRequestExecutor.java:123)  
> > > at org.apache.http.impl.execchain.MainClientExec.  
> > > execute(MainClientExec.java:254)  
> > > at org.apache.http.impl.execchain.ProtocolExec.  
> > > execute(ProtocolExec.java:195)  
> > > at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)  
> > > at org.apache.http.impl.execchain.RedirectExec.  
> > > execute(RedirectExec.java:108)  
> > > at org.apache.http.impl.client.InternalHttpClient.doExecute(  
> > > InternalHttpClient.java:186)  
> > > at org.apache.http.impl.client.CloseableHttpClient.execute(  
> > > CloseableHttpClient.java:82)  
> > > at org.apache.http.impl.client.CloseableHttpClient.execute(  
> > > CloseableHttpClient.java:106)  
> > > at io.searchbox.client.http.JestHttpClient.execute(  
> > > JestHttpClient.java:59)  
> > > at webservice.ESClient.main(ESClient.java:50)  
> > > Process exited with exit code 1.
> > > 
> > > --  
> > > You received this message because you are subscribed to a topic in the  
> > > Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit  
> > > [https://groups.google.com/d/topic/elasticsearch/gsweC\_svK38/unsubscribe](https://groups.google.com/d/topic/elasticsearch/gsweC_svK38/unsubscribe).  
> > > To unsubscribe from this group and all its topics, send an email to  
> > > [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/97d349ca-f12e-4be0-85fb-c05e17ede84e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/97d349ca-f12e-4be0-85fb-c05e17ede84e%40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/97d349ca-f12e-4be0-85fb-c05e17ede84e%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/97d349ca-f12e-4be0-85fb-c05e17ede84e%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/c58f6cfc-5564-43d0-b459-02ebd372c52e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c58f6cfc-5564-43d0-b459-02ebd372c52e%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![elk\_user1](https://avatars.discourse-cdn.com/v4/letter/e/a698b9/32.png) [@elk\_user1](https://discuss.elastic.co/u/elk_user1)\
**Post date:** [June 6, 2017, 6:59am UTC](https://discuss.elastic.co/t/sockettimeoutexception-while-using-jest-to-connect-to-es/18320/8 "2017-06-06T06:59:57Z")

</div>

I'm facing same exception. Could anyone please respond how this was resolved?

Thanks in advance.

---

<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:** [November 4, 2022, 4:01am UTC](https://discuss.elastic.co/t/sockettimeoutexception-while-using-jest-to-connect-to-es/18320/9 "2022-11-04T04:01:25Z")

</div>


