# Java client - setTimeout vs actionGet(timeout)

**URL:** <https://discuss.elastic.co/t/java-client-settimeout-vs-actionget-timeout/20992>\
**Category:** Elasticsearch\
**Created:** [November 30, 2014, 3:40pm UTC](https://discuss.elastic.co/t/java-client-settimeout-vs-actionget-timeout/20992 "2014-11-30T15:40:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ron\_Sher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ron_sher/32/4472_2.png) [@Ron\_Sher](https://discuss.elastic.co/u/Ron_Sher)\
**Post date:** [November 30, 2014, 3:40pm UTC](https://discuss.elastic.co/t/java-client-settimeout-vs-actionget-timeout/20992/1 "2014-11-30T15:40:57Z")

</div>

Hi all,

I want to make sure the search query doesn't exceed some limit.

I've seen the option to use a setTimeout vs actionGet(timeout).

Can someone please explain the difference?

Also, I've read somewhere that there's a default connection timeout. Can  
that be used instead. If so, how?

Thanks for your help,

Ron

--  
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/0f39e669-bd98-4fc3-afbc-df9e3d9b1f52%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0f39e669-bd98-4fc3-afbc-df9e3d9b1f52%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [November 30, 2014, 3:53pm UTC](https://discuss.elastic.co/t/java-client-settimeout-vs-actionget-timeout/20992/2 "2014-11-30T15:53:36Z")

</div>

Timeouts are server side and best effort. I believe action get(timeout) is  
client side.

I use the http client but use both and set the server side timeout to lower  
than the client side timeout.

The server side timeout should return partial results if possible.  
On Nov 30, 2014 10:41 AM, "Ron Sher" [ron.sher@gmail.com](mailto:ron.sher@gmail.com) wrote:

> Hi all,
> 
> I want to make sure the search query doesn't exceed some limit.
> 
> I've seen the option to use a setTimeout vs actionGet(timeout).
> 
> Can someone please explain the difference?
> 
> Also, I've read somewhere that there's a default connection timeout. Can  
> that be used instead. If so, how?
> 
> Thanks for your help,
> 
> Ron
> 
> --  
> 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/0f39e669-bd98-4fc3-afbc-df9e3d9b1f52%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0f39e669-bd98-4fc3-afbc-df9e3d9b1f52%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/0f39e669-bd98-4fc3-afbc-df9e3d9b1f52%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0f39e669-bd98-4fc3-afbc-df9e3d9b1f52%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/CAPmjWd1boDs7Racvx9kJDc4wUiQ0mhTbH5XOtD88h%2BJ2fA%2B8RQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPmjWd1boDs7Racvx9kJDc4wUiQ0mhTbH5XOtD88h%2BJ2fA%2B8RQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ron\_Sher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ron_sher/32/4472_2.png) [@Ron\_Sher](https://discuss.elastic.co/u/Ron_Sher)\
**Post date:** [November 30, 2014, 6:45pm UTC](https://discuss.elastic.co/t/java-client-settimeout-vs-actionget-timeout/20992/3 "2014-11-30T18:45:56Z")

</div>

Thanks for the info.

Do you know what are the defaults?

On Sunday, November 30, 2014 5:53:49 PM UTC+2, Nikolas Everett wrote:

> Timeouts are server side and best effort. I believe action get(timeout) is  
> client side.
> 
> I use the http client but use both and set the server side timeout to  
> lower than the client side timeout.
> 
> The server side timeout should return partial results if possible.  
> On Nov 30, 2014 10:41 AM, "Ron Sher" \<[ron....@gmail.com](mailto:ron....@gmail.com) \<javascript:\>\>  
> wrote:
> 
> > Hi all,
> > 
> > I want to make sure the search query doesn't exceed some limit.
> > 
> > I've seen the option to use a setTimeout vs actionGet(timeout).
> > 
> > Can someone please explain the difference?
> > 
> > Also, I've read somewhere that there's a default connection timeout. Can  
> > that be used instead. If so, how?
> > 
> > Thanks for your help,
> > 
> > Ron
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/0f39e669-bd98-4fc3-afbc-df9e3d9b1f52%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0f39e669-bd98-4fc3-afbc-df9e3d9b1f52%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/0f39e669-bd98-4fc3-afbc-df9e3d9b1f52%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0f39e669-bd98-4fc3-afbc-df9e3d9b1f52%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/660f86bb-0f96-431c-acb5-aa4f5971578a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/660f86bb-0f96-431c-acb5-aa4f5971578a%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [November 30, 2014, 9:37pm UTC](https://discuss.elastic.co/t/java-client-settimeout-vs-actionget-timeout/20992/4 "2014-11-30T21:37:33Z")

</div>

Default for server side timeout is none and I don't know client side  
timeout. I imagine it is a long time.  
On Nov 30, 2014 1:46 PM, "Ron Sher" [ron.sher@gmail.com](mailto:ron.sher@gmail.com) wrote:

> Thanks for the info.
> 
> Do you know what are the defaults?
> 
> On Sunday, November 30, 2014 5:53:49 PM UTC+2, Nikolas Everett wrote:
> 
> > Timeouts are server side and best effort. I believe action get(timeout)  
> > is client side.
> > 
> > I use the http client but use both and set the server side timeout to  
> > lower than the client side timeout.
> > 
> > The server side timeout should return partial results if possible.  
> > On Nov 30, 2014 10:41 AM, "Ron Sher" [ron....@gmail.com](mailto:ron....@gmail.com) wrote:
> > 
> > > Hi all,
> > > 
> > > I want to make sure the search query doesn't exceed some limit.
> > > 
> > > I've seen the option to use a setTimeout vs actionGet(timeout).
> > > 
> > > Can someone please explain the difference?
> > > 
> > > Also, I've read somewhere that there's a default connection timeout. Can  
> > > that be used instead. If so, how?
> > > 
> > > Thanks for your help,
> > > 
> > > Ron
> > > 
> > > --  
> > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > msgid/elasticsearch/0f39e669-bd98-4fc3-afbc-df9e3d9b1f52%  
> > > [40googlegroups.com](http://40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/0f39e669-bd98-4fc3-afbc-df9e3d9b1f52%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0f39e669-bd98-4fc3-afbc-df9e3d9b1f52%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/660f86bb-0f96-431c-acb5-aa4f5971578a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/660f86bb-0f96-431c-acb5-aa4f5971578a%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/660f86bb-0f96-431c-acb5-aa4f5971578a%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/660f86bb-0f96-431c-acb5-aa4f5971578a%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/CAPmjWd0uKbdDubBAS-9AhwW4G2gQbJHs-fAg\_qkhv0WcRn1K%2BQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPmjWd0uKbdDubBAS-9AhwW4G2gQbJHs-fAg_qkhv0WcRn1K%2BQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Itamar\_Syn\_Hershko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/itamar_syn_hershko/32/725_2.png) [@Itamar\_Syn\_Hershko](https://discuss.elastic.co/u/Itamar_Syn_Hershko)\
**Post date:** [December 1, 2014, 12:48am UTC](https://discuss.elastic.co/t/java-client-settimeout-vs-actionget-timeout/20992/5 "2014-12-01T00:48:20Z")

</div>

IIRC the Java API doesn't have any default client-side timeout for search  
requests, its an opt-in feature

--

Itamar Syn-Hershko  
[http://code972.com](http://code972.com) | @synhershko [https://twitter.com/synhershko](https://twitter.com/synhershko)  
Freelance Developer & Consultant  
Author of RavenDB in Action [http://manning.com/synhershko/](http://manning.com/synhershko/)

On Sun, Nov 30, 2014 at 11:37 PM, Nikolas Everett [nik9000@gmail.com](mailto:nik9000@gmail.com) wrote:

> Default for server side timeout is none and I don't know client side  
> timeout. I imagine it is a long time.  
> On Nov 30, 2014 1:46 PM, "Ron Sher" [ron.sher@gmail.com](mailto:ron.sher@gmail.com) wrote:
> 
> > Thanks for the info.
> > 
> > Do you know what are the defaults?
> > 
> > On Sunday, November 30, 2014 5:53:49 PM UTC+2, Nikolas Everett wrote:
> > 
> > > Timeouts are server side and best effort. I believe action get(timeout)  
> > > is client side.
> > > 
> > > I use the http client but use both and set the server side timeout to  
> > > lower than the client side timeout.
> > > 
> > > The server side timeout should return partial results if possible.  
> > > On Nov 30, 2014 10:41 AM, "Ron Sher" [ron....@gmail.com](mailto:ron....@gmail.com) wrote:
> > > 
> > > > Hi all,
> > > > 
> > > > I want to make sure the search query doesn't exceed some limit.
> > > > 
> > > > I've seen the option to use a setTimeout vs actionGet(timeout).
> > > > 
> > > > Can someone please explain the difference?
> > > > 
> > > > Also, I've read somewhere that there's a default connection timeout.  
> > > > Can that be used instead. If so, how?
> > > > 
> > > > Thanks for your help,
> > > > 
> > > > Ron
> > > > 
> > > > --  
> > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > msgid/elasticsearch/0f39e669-bd98-4fc3-afbc-df9e3d9b1f52%  
> > > > [40googlegroups.com](http://40googlegroups.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/0f39e669-bd98-4fc3-afbc-df9e3d9b1f52%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0f39e669-bd98-4fc3-afbc-df9e3d9b1f52%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/660f86bb-0f96-431c-acb5-aa4f5971578a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/660f86bb-0f96-431c-acb5-aa4f5971578a%40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/660f86bb-0f96-431c-acb5-aa4f5971578a%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/660f86bb-0f96-431c-acb5-aa4f5971578a%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/CAPmjWd0uKbdDubBAS-9AhwW4G2gQbJHs-fAg\_qkhv0WcRn1K%2BQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPmjWd0uKbdDubBAS-9AhwW4G2gQbJHs-fAg_qkhv0WcRn1K%2BQ%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAPmjWd0uKbdDubBAS-9AhwW4G2gQbJHs-fAg\_qkhv0WcRn1K%2BQ%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAPmjWd0uKbdDubBAS-9AhwW4G2gQbJHs-fAg_qkhv0WcRn1K%2BQ%40mail.gmail.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/CAHTr4ZtfnhCZJUrKv7fDc-hO%3D3Dpgv8xjUK3up3cCiaY60SmCQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHTr4ZtfnhCZJUrKv7fDc-hO%3D3Dpgv8xjUK3up3cCiaY60SmCQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 12:46am UTC](https://discuss.elastic.co/t/java-client-settimeout-vs-actionget-timeout/20992/6 "2017-07-06T00:46:59Z")

</div>


