# Removing TTL during document update

**URL:** <https://discuss.elastic.co/t/removing-ttl-during-document-update/16914>\
**Category:** Elasticsearch\
**Created:** [April 9, 2014, 11:44pm UTC](https://discuss.elastic.co/t/removing-ttl-during-document-update/16914 "2014-04-09T23:44:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![slushi](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@slushi](https://discuss.elastic.co/u/slushi)\
**Post date:** [April 9, 2014, 11:44pm UTC](https://discuss.elastic.co/t/removing-ttl-during-document-update/16914/1 "2014-04-09T23:44:22Z")

</div>

I am trying to remove the TTL setting when doing a document update  
(doc\_as\_upsert) via the java api. I do the following:

UpdateRequestBuilder b = new UpdateRequestBuilder(client);

b.setDocAsUpsert(true);

b.setDoc(dataMap);  
...

UpdateRequest request = b.request();

request.doc().ttl(null);

...

If I set a value here instead of null, the TTL is successfully updated.  
However passing null doesn't seem to remove the TTL. Is there another way  
to do this? The comments for the ttl(Long) method seem to indicate passing  
null should reset the TTL (I am on 0.90.11)

--  
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/0ca00b1d-a7ff-4b38-b69e-63be75886ab3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0ca00b1d-a7ff-4b38-b69e-63be75886ab3%40googlegroups.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, 1:37am UTC](https://discuss.elastic.co/t/removing-ttl-during-document-update/16914/2 "2017-07-06T01:37:00Z")

</div>

Closed on July 6, 2017, 1:37am UTC


