Transport Client hangs in my web application during search

I have a web application in which I create a Transport Client using Spring
(singleton) and inject it into my service. When I receive a request in my
controller, controller calls the service and service uses the transport
client to execute the query and return the results. When I deploy this
application in tomcat, I have the client created but when I execute the
query, client hangs.

If I create the client for every request (in my service) and run the query,
everything is fine. Can some one help me understand this behavior?

Following is my code to create the Client object.

Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name",
"mysearchcluster").put("client.transport.sniff", true).build();
Client client = new TransportClient(settings).addTransportAddress(new
InetSocketTransportAddress("10.150.200.101", 9300));

Thanks

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/4c846ec4-15c5-4c6f-9e1c-6c56912cc2ee%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Does it show anything in the log? Perhaps try catch block on your code and
set a query timeout.

HTH

/Jason

On Wed, Jan 8, 2014 at 4:41 AM, Search User feedworks@gmail.com wrote:

I have a web application in which I create a Transport Client using Spring
(singleton) and inject it into my service. When I receive a request in my
controller, controller calls the service and service uses the transport
client to execute the query and return the results. When I deploy this
application in tomcat, I have the client created but when I execute the
query, client hangs.

If I create the client for every request (in my service) and run the
query, everything is fine. Can some one help me understand this behavior?

Following is my code to create the Client object.

Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name"
, "mysearchcluster").put("client.transport.sniff", true).build();
Client client = new TransportClient(settings).addTransportAddress(new
InetSocketTransportAddress("10.150.200.101", 9300));

Thanks

--
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/4c846ec4-15c5-4c6f-9e1c-6c56912cc2ee%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAHO4itxM795Xuo8tikF4oADgYH50R58Y8B0qwdMz4nU82koN3w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Your code looks good to me.
Don't create multiple client but only one for your whole application.

As Jason wrote, look at logs.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 8 janv. 2014 à 07:40, Jason Wee peichieh@gmail.com a écrit :

Does it show anything in the log? Perhaps try catch block on your code and set a query timeout.

HTH

/Jason

On Wed, Jan 8, 2014 at 4:41 AM, Search User feedworks@gmail.com wrote:
I have a web application in which I create a Transport Client using Spring (singleton) and inject it into my service. When I receive a request in my controller, controller calls the service and service uses the transport client to execute the query and return the results. When I deploy this application in tomcat, I have the client created but when I execute the query, client hangs.

If I create the client for every request (in my service) and run the query, everything is fine. Can some one help me understand this behavior?

Following is my code to create the Client object.

Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", "mysearchcluster").put("client.transport.sniff", true).build();
Client client = new TransportClient(settings).addTransportAddress(new InetSocketTransportAddress("10.150.200.101", 9300));

Thanks

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/4c846ec4-15c5-4c6f-9e1c-6c56912cc2ee%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAHO4itxM795Xuo8tikF4oADgYH50R58Y8B0qwdMz4nU82koN3w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/FD569ACE-1811-4FEC-AFDC-7DA96A621B61%40pilato.fr.
For more options, visit https://groups.google.com/groups/opt_out.

If you turn off your sniff settings to false it will work.

On Wednesday, January 8, 2014 2:11:10 AM UTC+5:30, Search User wrote:

I have a web application in which I create a Transport Client using Spring
(singleton) and inject it into my service. When I receive a request in my
controller, controller calls the service and service uses the transport
client to execute the query and return the results. When I deploy this
application in tomcat, I have the client created but when I execute the
query, client hangs.

If I create the client for every request (in my service) and run the
query, everything is fine. Can some one help me understand this behavior?

Following is my code to create the Client object.

Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name"
, "mysearchcluster").put("client.transport.sniff", true).build();
Client client = new TransportClient(settings).addTransportAddress(new
InetSocketTransportAddress("10.150.200.101", 9300));

Thanks

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/f48f2929-f9e9-4576-823b-42563004fe10%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.