# Transport client TTL, seconds or milliseconds

**URL:** <https://discuss.elastic.co/t/transport-client-ttl-seconds-or-milliseconds/21149>\
**Category:** Elasticsearch\
**Created:** [December 8, 2014, 4:43pm UTC](https://discuss.elastic.co/t/transport-client-ttl-seconds-or-milliseconds/21149 "2014-12-08T16:43:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![burtonator](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/burtonator/32/44790_2.png) [@burtonator](https://discuss.elastic.co/u/burtonator)\
**Post date:** [December 8, 2014, 4:43pm UTC](https://discuss.elastic.co/t/transport-client-ttl-seconds-or-milliseconds/21149/1 "2014-12-08T16:43:49Z")

</div>

I'm performing writes with the transport client.

I can't find documentation for whether the ttl is in seconds or  
milliseconds.

I know if you send documents via json the TTL is a strong so you can say  
"1s" but the setTTL method in IndexRequestBuilder just takes a long.

I THINK it's seconds because my documents are staying around too long (as  
I"m setting them in ms).

Can anyone confirm?

The Javadoc probably should be updated to reflect this as I couldn't find  
it anywhere. IE it's not in the RTFM

--  
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/883794e5-e0ae-43eb-a3e1-58979bd8a183%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/883794e5-e0ae-43eb-a3e1-58979bd8a183%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 8, 2014, 4:51pm UTC](https://discuss.elastic.co/t/transport-client-ttl-seconds-or-milliseconds/21149/2 "2014-12-08T16:51:05Z")

</div>

I agree.

We should have both a Javadoc and some explanations in the java API documentation.

Wanna contribute and send a PR for the javadoc or for both?

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr) | @scrutmydocs [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)

> Le 8 déc. 2014 à 17:43, Kevin Burton [burtonator@gmail.com](mailto:burtonator@gmail.com) a écrit :
> 
> I'm performing writes with the transport client.
> 
> I can't find documentation for whether the ttl is in seconds or milliseconds.
> 
> I know if you send documents via json the TTL is a strong so you can say "1s" but the setTTL method in IndexRequestBuilder just takes a long.
> 
> I THINK it's seconds because my documents are staying around too long (as I"m setting them in ms).
> 
> Can anyone confirm?
> 
> The Javadoc probably should be updated to reflect this as I couldn't find it anywhere. IE it's not in the RTFM
> 
> --  
> 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) [mailto:elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/883794e5-e0ae-43eb-a3e1-58979bd8a183%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/883794e5-e0ae-43eb-a3e1-58979bd8a183%40googlegroups.com) [https://groups.google.com/d/msgid/elasticsearch/883794e5-e0ae-43eb-a3e1-58979bd8a183%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/883794e5-e0ae-43eb-a3e1-58979bd8a183%40googlegroups.com?utm_medium=email&utm_source=footer).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout) [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/E31CAE39-8F43-4488-BDB5-96B0C1421A7D%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/E31CAE39-8F43-4488-BDB5-96B0C1421A7D%40pilato.fr).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![burtonator](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/burtonator/32/44790_2.png) [@burtonator](https://discuss.elastic.co/u/burtonator)\
**Post date:** [December 8, 2014, 6:27pm UTC](https://discuss.elastic.co/t/transport-client-ttl-seconds-or-milliseconds/21149/3 "2014-12-08T18:27:59Z")

</div>

Ha. Generally speaking, yes, I would, but I don't have an answer whether  
it's in seconds or milliseconds 🙂

If I get an answer I'll try it and if it works I'll update the docs.

Kevin

--  
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/44c29924-a243-4071-b792-cbba6e4cf95d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/44c29924-a243-4071-b792-cbba6e4cf95d%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 8, 2014, 7:17pm UTC](https://discuss.elastic.co/t/transport-client-ttl-seconds-or-milliseconds/21149/4 "2014-12-08T19:17:49Z")

</div>

From my tests, it’s ms:

IndexRequest indexRequest = new IndexRequest("ttl", "doc", "1")  
.source(jsonBuilder().startObject().field("foo", "bar").endObject())  
.ttl(1000L);

Means 1s delay

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr) | @scrutmydocs [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)

> Le 8 déc. 2014 à 19:27, Kevin Burton [burtonator@gmail.com](mailto:burtonator@gmail.com) a écrit :
> 
> Ha. Generally speaking, yes, I would, but I don't have an answer whether it's in seconds or milliseconds 🙂
> 
> If I get an answer I'll try it and if it works I'll update the docs.
> 
> Kevin
> 
> --  
> 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) [mailto:elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/44c29924-a243-4071-b792-cbba6e4cf95d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/44c29924-a243-4071-b792-cbba6e4cf95d%40googlegroups.com) [https://groups.google.com/d/msgid/elasticsearch/44c29924-a243-4071-b792-cbba6e4cf95d%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/44c29924-a243-4071-b792-cbba6e4cf95d%40googlegroups.com?utm_medium=email&utm_source=footer).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout) [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/21A0B409-2A07-42B6-ABD7-DE62758C730D%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/21A0B409-2A07-42B6-ABD7-DE62758C730D%40pilato.fr).  
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:44am UTC](https://discuss.elastic.co/t/transport-client-ttl-seconds-or-milliseconds/21149/5 "2017-07-06T00:44:54Z")

</div>


