# Is there a way to export \_ttl from docs?

**URL:** <https://discuss.elastic.co/t/is-there-a-way-to-export-ttl-from-docs/273028>\
**Category:** Elasticsearch\
**Created:** [May 14, 2021, 2:09pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-export-ttl-from-docs/273028 "2021-05-14T14:09:52Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![rschirin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rschirin/32/45283_2.png) [@rschirin](https://discuss.elastic.co/u/rschirin)\
**Post date:** [May 14, 2021, 2:09pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-export-ttl-from-docs/273028/1 "2021-05-14T14:09:52Z")

</div>

Hey there,  
if `_ttl` expiration value is configured within the documents of an index, is there a way to export/reindex those documents with the `_ttl` value of that moment?  
For instance, using Logstash `elasticsearch input` we can inherit \_id but no way to get the \_ttl

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 14, 2021, 2:16pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-export-ttl-from-docs/273028/2 "2021-05-14T14:16:13Z")

</div>

Which version are you using? TTL has as far as I know been deprecated quite a long time.

---

<div class="post-metadata">

**Author:** ![rschirin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rschirin/32/45283_2.png) [@rschirin](https://discuss.elastic.co/u/rschirin)\
**Post date:** [May 14, 2021, 9:29pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-export-ttl-from-docs/273028/3 "2021-05-14T21:29:30Z")

</div>

At the end of my process I have to migrate data from a 2.4 version to 7.x but before that I have to change my infrastructure so for the moment I have to migrate from a 2.4 to another 2.4 (I am trying to use logstash)

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 15, 2021, 5:33am UTC](https://discuss.elastic.co/t/is-there-a-way-to-export-ttl-from-docs/273028/4 "2021-05-15T05:33:39Z")

</div>

I have not used version 2.x in years so do not recall how TTL worked apart from that it was quite inefficient. If the TTL value is not in the document I suspect you may not be able to export it. Using snapshot and restore to move the data might be better. You could perhaps also set up a newer cluster and reindex from remote, but it is hard to know without knowing the use case and constraints.

---

<div class="post-metadata">

**Author:** ![rschirin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rschirin/32/45283_2.png) [@rschirin](https://discuss.elastic.co/u/rschirin)\
**Post date:** [May 15, 2021, 1:18pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-export-ttl-from-docs/273028/5 "2021-05-15T13:18:18Z")

</div>

About snapshot and restore, are you talking of simple snapshot of VM?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 15, 2021, 1:25pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-export-ttl-from-docs/273028/6 "2021-05-15T13:25:08Z")

</div>

No, using the Elasticsearch snapshot/restore API.

---

<div class="post-metadata">

**Author:** ![rschirin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rschirin/32/45283_2.png) [@rschirin](https://discuss.elastic.co/u/rschirin)\
**Post date:** [May 15, 2021, 6:42pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-export-ttl-from-docs/273028/7 "2021-05-15T18:42:24Z")

</div>

Hmmm.... Is it possible to use snapshot/restore with source Elasticsearch 2.4 and destination Elasticsearch 2.4?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 15, 2021, 7:13pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-export-ttl-from-docs/273028/8 "2021-05-15T19:13:30Z")

</div>

Yes.

---

<div class="post-metadata">

**Author:** ![rschirin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rschirin/32/45283_2.png) [@rschirin](https://discuss.elastic.co/u/rschirin)\
**Post date:** [May 21, 2021, 10:40am UTC](https://discuss.elastic.co/t/is-there-a-way-to-export-ttl-from-docs/273028/9 "2021-05-21T10:40:42Z")

</div>

after further investigation, snapshot/restore option is not possible since src nodes and dst nodes could not share the same disk where snapshot will be stored 😭  
I was thinking to script option in the Logstash `elasticsearch output`. Maybe is it possible to get the \_ttl value and import it with script?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 21, 2021, 10:49am UTC](https://discuss.elastic.co/t/is-there-a-way-to-export-ttl-from-docs/273028/10 "2021-05-21T10:49:09Z")

</div>

You can take a snapshot to shared storage in one place and then move that data over to the new cluster and mount it there.

---

<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:** [June 18, 2021, 10:49am UTC](https://discuss.elastic.co/t/is-there-a-way-to-export-ttl-from-docs/273028/11 "2021-06-18T10:49:33Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
