# Making Source Compression on by default at index creation time without explicit mappings

**URL:** <https://discuss.elastic.co/t/making-source-compression-on-by-default-at-index-creation-time-without-explicit-mappings/7545>\
**Category:** Elasticsearch\
**Created:** [May 3, 2012, 1:12am UTC](https://discuss.elastic.co/t/making-source-compression-on-by-default-at-index-creation-time-without-explicit-mappings/7545 "2012-05-03T01:12:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Smith](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paul_smith/32/1323_2.png) [@Paul\_Smith](https://discuss.elastic.co/u/Paul_Smith)\
**Post date:** [May 3, 2012, 1:12am UTC](https://discuss.elastic.co/t/making-source-compression-on-by-default-at-index-creation-time-without-explicit-mappings/7545/1 "2012-05-03T01:12:37Z")

</div>

IIUC, \_source compression is available, but off by default, and it can be  
turned on at either index creation, or by changing the mappings. However  
IIUC as well, the compression setting needs to be set per-index-type?

Reading the index creation, as well as the mapping docs, there doesn't seem  
to be a way to set compression to be on by default for all types that  
appear, one would have to define it to be on for the expected types.

Would it seem (even) more useful to have a per-index top level setting to  
make compression on by default rather than need to explicitly set it  
per-type in the mappings?

cheers,

Paul

---

<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:** [May 3, 2012, 12:01pm UTC](https://discuss.elastic.co/t/making-source-compression-on-by-default-at-index-creation-time-without-explicit-mappings/7545/2 "2012-05-03T12:01:15Z")

</div>

Hi Paul

On Thu, 2012-05-03 at 11:12 +1000, Paul Smith wrote:

> IIUC, \_source compression is available, but off by default, and it can  
> be turned on at either index creation, or by changing the mappings.  
> However IIUC as well, the compression setting needs to be set  
> per-index-type?
> 
> Reading the index creation, as well as the mapping docs, there doesn't  
> seem to be a way to set compression to be on by default for all types  
> that appear, one would have to define it to be on for the expected  
> types.
> 
> Would it seem (even) more useful to have a per-index top level setting  
> to make compression on by default rather than need to explicitly set  
> it per-type in the mappings?

You can do this by putting a mapping for the type '_default_' which is  
then the base for any other types that you map

clint

> cheers,
> 
> Paul

---

<div class="post-metadata">

**Author:** ![Paul\_Smith](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paul_smith/32/1323_2.png) [@Paul\_Smith](https://discuss.elastic.co/u/Paul_Smith)\
**Post date:** [May 3, 2012, 12:12pm UTC](https://discuss.elastic.co/t/making-source-compression-on-by-default-at-index-creation-time-without-explicit-mappings/7545/3 "2012-05-03T12:12:04Z")

</div>

wahay! thanks clinton, presumably I can then just set this cluster wide  
via the "default-mapping.json" file in the cluster then too right?

that's cool, thanks, I had forgotten about this part of dynamic mappings,  
cheers.

Paul

On 3 May 2012 22:01, Clinton Gormley [clint@traveljury.com](mailto:clint@traveljury.com) wrote:

> Hi Paul
> 
> On Thu, 2012-05-03 at 11:12 +1000, Paul Smith wrote:
> 
> > IIUC, \_source compression is available, but off by default, and it can  
> > be turned on at either index creation, or by changing the mappings.  
> > However IIUC as well, the compression setting needs to be set  
> > per-index-type?
> > 
> > Reading the index creation, as well as the mapping docs, there doesn't  
> > seem to be a way to set compression to be on by default for all types  
> > that appear, one would have to define it to be on for the expected  
> > types.
> > 
> > Would it seem (even) more useful to have a per-index top level setting  
> > to make compression on by default rather than need to explicitly set  
> > it per-type in the mappings?
> 
> You can do this by putting a mapping for the type '_default_' which is  
> then the base for any other types that you map
> 
> clint
> 
> > cheers,
> > 
> > Paul

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [May 4, 2012, 1:18pm UTC](https://discuss.elastic.co/t/making-source-compression-on-by-default-at-index-creation-time-without-explicit-mappings/7545/4 "2012-05-04T13:18:00Z")

</div>

Yes, you can also set it in default-mapping.json, though the new preferred  
way is to simply put an index template, with a template matching all (\*),  
and then in it have _defualt_ mapping with the compression of \_source set  
to true.

On Thu, May 3, 2012 at 3:12 PM, Paul Smith [tallpsmith@gmail.com](mailto:tallpsmith@gmail.com) wrote:

> wahay! thanks clinton, presumably I can then just set this cluster wide  
> via the "default-mapping.json" file in the cluster then too right?
> 
> that's cool, thanks, I had forgotten about this part of dynamic mappings,  
> cheers.
> 
> Paul
> 
> On 3 May 2012 22:01, Clinton Gormley [clint@traveljury.com](mailto:clint@traveljury.com) wrote:
> 
> > Hi Paul
> > 
> > On Thu, 2012-05-03 at 11:12 +1000, Paul Smith wrote:
> > 
> > > IIUC, \_source compression is available, but off by default, and it can  
> > > be turned on at either index creation, or by changing the mappings.  
> > > However IIUC as well, the compression setting needs to be set  
> > > per-index-type?
> > > 
> > > Reading the index creation, as well as the mapping docs, there doesn't  
> > > seem to be a way to set compression to be on by default for all types  
> > > that appear, one would have to define it to be on for the expected  
> > > types.
> > > 
> > > Would it seem (even) more useful to have a per-index top level setting  
> > > to make compression on by default rather than need to explicitly set  
> > > it per-type in the mappings?
> > 
> > You can do this by putting a mapping for the type '_default_' which is  
> > then the base for any other types that you map
> > 
> > clint
> > 
> > > cheers,
> > > 
> > > Paul

---

<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:30am UTC](https://discuss.elastic.co/t/making-source-compression-on-by-default-at-index-creation-time-without-explicit-mappings/7545/5 "2017-07-06T03:30:08Z")

</div>


