# Compressing ElasticSearch and extracting template settings

**URL:** <https://discuss.elastic.co/t/compressing-elasticsearch-and-extracting-template-settings/6857>\
**Category:** Elasticsearch\
**Created:** [March 1, 2012, 6:52pm UTC](https://discuss.elastic.co/t/compressing-elasticsearch-and-extracting-template-settings/6857 "2012-03-01T18:52:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeremy\_Schultz](https://avatars.discourse-cdn.com/v4/letter/j/a6a055/32.png) [@Jeremy\_Schultz](https://discuss.elastic.co/u/Jeremy_Schultz)\
**Post date:** [March 1, 2012, 6:52pm UTC](https://discuss.elastic.co/t/compressing-elasticsearch-and-extracting-template-settings/6857/1 "2012-03-01T18:52:55Z")

</div>

I am using the logstash's built-in ElasticSearch and I want to optimize the  
storage used.

I have found the following on the Wiki:

> **[elastic/logstash](https://github.com/elastic/logstash)**
>
> logstash - Logstash - transport and process your logs, events, or other data

If I Compress \_source as shown below, will this setting still be present  
after logstash(elasticsearch) has been restarted or will I need to re-apply  
it?

curl -XPUT '[http://localhost:9200/\_template/template\_logstash/](http://localhost:9200/_template/template_logstash/)' -d '  
{  
"template": "logstash-\*",  
"mappings": {  
"_default_": { "\_source": { "compress": "true" } }  
}  
}'

Also is their a way to pull the current setting and/or templates that  
logstash’s elasticsearch is using?

---

<div class="post-metadata">

**Author:** ![Radu\_Gheorghe1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/radu_gheorghe1/32/2688_2.png) [@Radu\_Gheorghe1](https://discuss.elastic.co/u/Radu_Gheorghe1)\
**Post date:** [March 2, 2012, 5:06pm UTC](https://discuss.elastic.co/t/compressing-elasticsearch-and-extracting-template-settings/6857/2 "2012-03-02T17:06:19Z")

</div>

On Mar 1, 8:52 pm, Jeremy Schultz [taoz...@gmail.com](mailto:taoz...@gmail.com) wrote:

> I am using the logstash's built-in Elasticsearch and I want to optimize the  
> storage used.
> 
> I have found the following on the Wiki:[GitHub - elastic/logstash: Logstash - transport and process your logs, events, or other data](https://github.com/logstash/logstash/wiki/Elasticsearch-Storage-Optim)...
> 
> If I Compress \_source as shown below, will this setting still be present  
> after logstash(elasticsearch) has been restarted or will I need to re-apply  
> it?

The settings should be persistent.

> curl -XPUT '[http://localhost:9200/\_template/template\_logstash/'-d](http://localhost:9200/_template/template_logstash/'-d) '  
> {  
> "template": "logstash-\*",  
> "mappings": {  
> "_default_": { "\_source": { "compress": "true" } }  
> }
> 
> }'
> 
> Also is their a way to pull the current setting and/or templates that  
> logstash’s elasticsearch is using?

Yes:  
curl -XGET '[http://localhost:9200/\_cluster/state?pretty=true](http://localhost:9200/_cluster/state?pretty=true)'

The ?pretty=true part is optional, but pretty 😃

---

<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:37am UTC](https://discuss.elastic.co/t/compressing-elasticsearch-and-extracting-template-settings/6857/3 "2017-07-06T03:37:34Z")

</div>

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


