# Setting source compression on existing index not working

**URL:** <https://discuss.elastic.co/t/setting-source-compression-on-existing-index-not-working/9839>\
**Category:** Elasticsearch\
**Created:** [November 27, 2012, 8:52am UTC](https://discuss.elastic.co/t/setting-source-compression-on-existing-index-not-working/9839 "2012-11-27T08:52:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![T\_Vinod\_Gupta](https://avatars.discourse-cdn.com/v4/letter/t/fbc32d/32.png) [@T\_Vinod\_Gupta](https://discuss.elastic.co/u/T_Vinod_Gupta)\
**Post date:** [November 27, 2012, 8:52am UTC](https://discuss.elastic.co/t/setting-source-compression-on-existing-index-not-working/9839/1 "2012-11-27T08:52:14Z")

</div>

hi,  
i want to enable source compression on an existing test index. but i dont  
think my setting is working. can someone confirm -

curl -XPUT '[http://localhost:9200/test/\_settings?pretty=true](http://localhost:9200/test/_settings?pretty=true)' -d '{"index"  
: { "\_source" : {"compress" : true } } }'  
{  
"ok" : true  
}

curl -XGET '[http://localhost:9200/test/\_settings?pretty=true](http://localhost:9200/test/_settings?pretty=true)'  
{  
"test" : {  
"settings" : {  
"index.number\_of\_shards" : "5",  
"index.number\_of\_replicas" : "1",  
"index.refresh\_interval" : "60000"  
}  
}  
}

--

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [November 27, 2012, 8:55am UTC](https://discuss.elastic.co/t/setting-source-compression-on-existing-index-not-working/9839/2 "2012-11-27T08:55:37Z")

</div>

Hiya

> i want to enable source compression on an existing test index. but i  
> dont think my setting is working. can someone confirm -
> 
> curl -XPUT '[http://localhost:9200/test/\_settings?pretty=true](http://localhost:9200/test/_settings?pretty=true)' -d  
> '{"index" : { "\_source" : {"compress" : true } } }'  
> {  
> "ok" : true  
> }

It is a mapping, not an index setting, and a type is required:

curl -XPUT '[http://127.0.0.1:9200/test/my\_type/\_mapping?pretty=1](http://127.0.0.1:9200/test/my_type/_mapping?pretty=1)' -d '  
{  
"my\_type" : {  
"\_source" : {  
"compress" : 1  
}  
}  
}  
'

--

---

<div class="post-metadata">

**Author:** ![T\_Vinod\_Gupta](https://avatars.discourse-cdn.com/v4/letter/t/fbc32d/32.png) [@T\_Vinod\_Gupta](https://discuss.elastic.co/u/T_Vinod_Gupta)\
**Post date:** [November 29, 2012, 7:12am UTC](https://discuss.elastic.co/t/setting-source-compression-on-existing-index-not-working/9839/3 "2012-11-29T07:12:28Z")

</div>

thanks, that worked!  
also, how long does one have to wait for the compression to start/end? i  
waited for 6hrs for 1 index and no change in size. running optimize also  
didnt make a difference. running optimize with max\_num\_segments=true  
decreased the size by a great amount.

thanks

On Tue, Nov 27, 2012 at 12:55 AM, Clinton Gormley [clint@traveljury.com](mailto:clint@traveljury.com)wrote:

> Hiya
> 
> > i want to enable source compression on an existing test index. but i  
> > dont think my setting is working. can someone confirm -
> > 
> > curl -XPUT '[http://localhost:9200/test/\_settings?pretty=true](http://localhost:9200/test/_settings?pretty=true)' -d  
> > '{"index" : { "\_source" : {"compress" : true } } }'  
> > {  
> > "ok" : true  
> > }
> 
> It is a mapping, not an index setting, and a type is required:
> 
> curl -XPUT '[http://127.0.0.1:9200/test/my\_type/\_mapping?pretty=1](http://127.0.0.1:9200/test/my_type/_mapping?pretty=1)' -d '  
> {  
> "my\_type" : {  
> "\_source" : {  
> "compress" : 1  
> }  
> }  
> }  
> '
> 
> --

--

---

<div class="post-metadata">

**Author:** ![radu\_gheorghe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/radu_gheorghe/32/556_2.png) [@radu\_gheorghe](https://discuss.elastic.co/u/radu_gheorghe)\
**Post date:** [November 29, 2012, 9:41am UTC](https://discuss.elastic.co/t/setting-source-compression-on-existing-index-not-working/9839/4 "2012-11-29T09:41:02Z")

</div>

Hello,

As far as I know, only the source of new documents will be compressed, from  
the moment you change your mapping.

## Best regards, Radu

[http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene

On Thu, Nov 29, 2012 at 9:12 AM, T Vinod Gupta [tvinod@readypulse.com](mailto:tvinod@readypulse.com)wrote:

> thanks, that worked!  
> also, how long does one have to wait for the compression to start/end? i  
> waited for 6hrs for 1 index and no change in size. running optimize also  
> didnt make a difference. running optimize with max\_num\_segments=true  
> decreased the size by a great amount.
> 
> thanks
> 
> On Tue, Nov 27, 2012 at 12:55 AM, Clinton Gormley [clint@traveljury.com](mailto:clint@traveljury.com)wrote:
> 
> > Hiya
> > 
> > > i want to enable source compression on an existing test index. but i  
> > > dont think my setting is working. can someone confirm -
> > > 
> > > curl -XPUT '[http://localhost:9200/test/\_settings?pretty=true](http://localhost:9200/test/_settings?pretty=true)' -d  
> > > '{"index" : { "\_source" : {"compress" : true } } }'  
> > > {  
> > > "ok" : true  
> > > }
> > 
> > It is a mapping, not an index setting, and a type is required:
> > 
> > curl -XPUT '[http://127.0.0.1:9200/test/my\_type/\_mapping?pretty=1](http://127.0.0.1:9200/test/my_type/_mapping?pretty=1)' -d '  
> > {  
> > "my\_type" : {  
> > "\_source" : {  
> > "compress" : 1  
> > }  
> > }  
> > }  
> > '
> > 
> > --
> 
> --

--

---

<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:02am UTC](https://discuss.elastic.co/t/setting-source-compression-on-existing-index-not-working/9839/5 "2017-07-06T03:02:16Z")

</div>


