# Compress and copy elasticsearc indexes

**URL:** <https://discuss.elastic.co/t/compress-and-copy-elasticsearc-indexes/86331>\
**Category:** Elasticsearch\
**Created:** [May 18, 2017, 8:28pm UTC](https://discuss.elastic.co/t/compress-and-copy-elasticsearc-indexes/86331 "2017-05-18T20:28:23Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![rwagner](https://avatars.discourse-cdn.com/v4/letter/r/d9b06d/32.png) [@rwagner](https://discuss.elastic.co/u/rwagner)\
**Post date:** [May 18, 2017, 8:28pm UTC](https://discuss.elastic.co/t/compress-and-copy-elasticsearc-indexes/86331/1 "2017-05-18T20:28:23Z")

</div>

Hi Guys!

My elasticsearch indexes are filling the disk. I would like to compress these indexes. Is it possible to compress these indexes and copy to another computer in a way that I can restore when needed?

Would anyone help me?

---

<div class="post-metadata">

**Author:** ![lwintergerst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lwintergerst/32/18164_2.png) [@lwintergerst](https://discuss.elastic.co/u/lwintergerst)\
**Post date:** [May 18, 2017, 8:45pm UTC](https://discuss.elastic.co/t/compress-and-copy-elasticsearc-indexes/86331/2 "2017-05-18T20:45:57Z")

</div>

Hi Roberto,  
take a look at Snapshot and Restore  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html)

This is our way of doing backups.  
While these have exactly the same storage size as your original data, you can compress them afterwards using any compression tool of your choice.  
This will take a long time and will slow down your restore (as it's not implemented into elasticsearch and has to be done separately) - so my advice would be to just start with snapshots without compressing them afterwards

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 18, 2017, 11:57pm UTC](https://discuss.elastic.co/t/compress-and-copy-elasticsearc-indexes/86331/3 "2017-05-18T23:57:26Z")

</div>

We compress data in ES by default, you can increase the default compression level though - [https://www.elastic.co/guide/en/elasticsearch/reference/5.4/tune-for-disk-usage.html#\_use\_literal\_best\_compression\_literal](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/tune-for-disk-usage.html#_use_literal_best_compression_literal)

---

<div class="post-metadata">

**Author:** ![rwagner](https://avatars.discourse-cdn.com/v4/letter/r/d9b06d/32.png) [@rwagner](https://discuss.elastic.co/u/rwagner)\
**Post date:** [May 22, 2017, 1:02pm UTC](https://discuss.elastic.co/t/compress-and-copy-elasticsearc-indexes/86331/4 "2017-05-22T13:02:53Z")

</div>

Hi @lwintergerst, i am new with elasticsearch. I know very little about elasticsearch, but by reading the page you have already published, I understand that it is only possible to take a snapshot of all indexes.

What I wanted to know is if, it is possible to back up only one or a few days of the indexes, for example, let's say I have the whole March month in logs. But I just want to back up the "logstash-2017.04.01", "logstash-2017.04.02" and "logstash-2017.04.03" indexes. I want to archive them on another machine and delete them from the machine where the elasticsearch is (this I know how to do, rsrs, "curl -XDELETE 'localhost: 9200 / logstash-2017.04.02'") but I want to keep the indexes archived as a backup form in another machine, so that I can someday restore it if necessary.

Sorry for the English, I do not speak very well. I hope you understood.

Thanks for the help!

---

<div class="post-metadata">

**Author:** ![rwagner](https://avatars.discourse-cdn.com/v4/letter/r/d9b06d/32.png) [@rwagner](https://discuss.elastic.co/u/rwagner)\
**Post date:** [May 22, 2017, 1:08pm UTC](https://discuss.elastic.co/t/compress-and-copy-elasticsearc-indexes/86331/5 "2017-05-22T13:08:25Z")

</div>

Hi @warkolm, thanks for the reply, but I do not know where I set this up. Is it in elasticserach.yml? It's just that I do not know much about elasticsearch.

---

<div class="post-metadata">

**Author:** ![lwintergerst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lwintergerst/32/18164_2.png) [@lwintergerst](https://discuss.elastic.co/u/lwintergerst)\
**Post date:** [May 23, 2017, 7:23am UTC](https://discuss.elastic.co/t/compress-and-copy-elasticsearc-indexes/86331/6 "2017-05-23T07:23:28Z")

</div>

Hello Roberto,  
This is what you are looking for. It is also part of the documentation that I linked above 🙂  
This will only back up "index\_1" and "index\_2"

```
PUT /_snapshot/my_backup/snapshot_1
{
  "indices": "index_1,index_2",
}
```

---

<div class="post-metadata">

**Author:** ![rwagner](https://avatars.discourse-cdn.com/v4/letter/r/d9b06d/32.png) [@rwagner](https://discuss.elastic.co/u/rwagner)\
**Post date:** [May 24, 2017, 12:07pm UTC](https://discuss.elastic.co/t/compress-and-copy-elasticsearc-indexes/86331/7 "2017-05-24T12:07:43Z")

</div>

😖  
Hi @lwintergerst, I researched more about this and was able to backup and delete some indices. Thank you!

---

<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 21, 2017, 12:07pm UTC](https://discuss.elastic.co/t/compress-and-copy-elasticsearc-indexes/86331/8 "2017-06-21T12:07:54Z")

</div>

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