# Should I regullary close the TransportClient

**URL:** <https://discuss.elastic.co/t/should-i-regullary-close-the-transportclient/8377>\
**Category:** Elasticsearch\
**Created:** [July 10, 2012, 1:58pm UTC](https://discuss.elastic.co/t/should-i-regullary-close-the-transportclient/8377 "2012-07-10T13:58:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ridvan\_Gyundogan](https://avatars.discourse-cdn.com/v4/letter/r/e495f1/32.png) [@Ridvan\_Gyundogan](https://discuss.elastic.co/u/Ridvan_Gyundogan)\
**Post date:** [July 10, 2012, 1:58pm UTC](https://discuss.elastic.co/t/should-i-regullary-close-the-transportclient/8377/1 "2012-07-10T13:58:38Z")

</div>

Hi I remember from Lucene that you have to close the reader sometimes  
so that Lucene can delete the old segment files.  
Does something similar apply to the TransportClient of elasticsearch?

---

<div class="post-metadata">

**Author:** ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)\
**Post date:** [July 10, 2012, 2:22pm UTC](https://discuss.elastic.co/t/should-i-regullary-close-the-transportclient/8377/2 "2012-07-10T14:22:49Z")

</div>

No, the idea of TransportClient is to create one, keep it around and reuse  
as much as possible. Typically, you keep one instance of TC for the life  
time of your application. It does not impact[1] low level Lucene segment  
stuff.

Regards,  
Lukas

[1] in some cases I think it can have some impact, like if you open a scan  
search [2] request but the impact is minimal IMO unless you do something  
terribly wrong with timeout setup.  
[2] [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/search-type.html)(see  
for scan or scroll)

On Tue, Jul 10, 2012 at 3:58 PM, Ridvan Gyundogan [ridvansg@gmail.com](mailto:ridvansg@gmail.com)wrote:

> Hi I remember from Lucene that you have to close the reader sometimes  
> so that Lucene can delete the old segment files.  
> Does something similar apply to the TransportClient of elasticsearch?

---

<div class="post-metadata">

**Author:** ![Ridvan\_Gyundogan](https://avatars.discourse-cdn.com/v4/letter/r/e495f1/32.png) [@Ridvan\_Gyundogan](https://discuss.elastic.co/u/Ridvan_Gyundogan)\
**Post date:** [July 10, 2012, 2:27pm UTC](https://discuss.elastic.co/t/should-i-regullary-close-the-transportclient/8377/3 "2012-07-10T14:27:38Z")

</div>

Thanks Lukas!

On Jul 10, 5:22 pm, Lukáš Vlček [lukas.vl...@gmail.com](mailto:lukas.vl...@gmail.com) wrote:

> No, the idea of TransportClient is to create one, keep it around and reuse  
> as much as possible. Typically, you keep one instance of TC for the life  
> time of your application. It does not impact[1] low level Lucene segment  
> stuff.
> 
> Regards,  
> Lukas
> 
> [1] in some cases I think it can have some impact, like if you open a scan  
> search [2] request but the impact is minimal IMO unless you do something  
> terribly wrong with timeout setup.  
> [2][Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/search-type.h)...  
> for scan or scroll)
> 
> On Tue, Jul 10, 2012 at 3:58 PM, Ridvan Gyundogan [ridva...@gmail.com](mailto:ridva...@gmail.com)wrote:
> 
> > Hi I remember from Lucene that you have to close the reader sometimes  
> > so that Lucene can delete the old segment files.  
> > Does something similar apply to the TransportClient of elasticsearch?

---

<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, 3:20am UTC](https://discuss.elastic.co/t/should-i-regullary-close-the-transportclient/8377/4 "2017-07-06T03:20:43Z")

</div>


