# Mapping of new fields

**URL:** https://discuss.elastic.co/t/mapping-of-new-fields/6140
**Category:** Elasticsearch
**Created:** [December 13, 2011, 2:46pm UTC](https://discuss.elastic.co/t/mapping-of-new-fields/6140 "2011-12-13T14:46:26Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Andrej](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@Andrej](https://discuss.elastic.co/u/Andrej)
#### Post date: [December 13, 2011, 2:46pm UTC](https://discuss.elastic.co/t/mapping-of-new-fields/6140/1 "2011-12-13T14:46:26Z")

</div>

Hi,

I have a question about mapping for new fields. I already have  
documents of a type (lets say test\_doc) in an index. Now I want to add  
a new field ("new") to this document. So far no problem. But what if I  
decide to not store this field in the source? Can I write a new  
mapping like

```
"test_doc" : {
"_source" : {
    "excludes" : ["new"]
    }
}

```

and add it to the index? Trying something similar with a new property  
works, but what about source? Is there a way to achieve my goal at  
all?

Thanks,  
Andrej

---

<div class="post-metadata">

### Author: ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)
#### Post date: [December 13, 2011, 8:50pm UTC](https://discuss.elastic.co/t/mapping-of-new-fields/6140/2 "2011-12-13T20:50:43Z")

</div>

Hi,

I think this can help you [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/source-field.html)  
(Check Includes/Excludes section)

--  
Regards,  
Lukas

On Tuesday, December 13, 2011 at 3:46 PM, Andrej Rosenheinrich wrote:

> Hi,
> 
> I have a question about mapping for new fields. I already have  
> documents of a type (lets say test\_doc) in an index. Now I want to add  
> a new field ("new") to this document. So far no problem. But what if I  
> decide to not store this field in the source? Can I write a new  
> mapping like
> 
> "test\_doc" : {  
> "\_source" : {  
> "excludes" : ["new"]  
> }  
> }
> 
> and add it to the index? Trying something similar with a new property  
> works, but what about source? Is there a way to achieve my goal at  
> all?
> 
> Thanks,  
> Andrej

---

<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: [December 13, 2011, 10:16pm UTC](https://discuss.elastic.co/t/mapping-of-new-fields/6140/3 "2011-12-13T22:16:13Z")

</div>

The only two mappings that can be changed (merged) into the \_source are  
compress and compress\_threshold. We can add exclude and include to allow  
them to be updated dynamically, open an issue (and possibly implement it,  
the code should be simple:  
[https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/index/mapper/internal/SourceFieldMapper.java#L342](https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/index/mapper/internal/SourceFieldMapper.java#L342)  
.

On Tue, Dec 13, 2011 at 4:46 PM, Andrej Rosenheinrich \<  
[andrej.rosenheinrich@unister.de](mailto:andrej.rosenheinrich@unister.de)\> wrote:

> Hi,
> 
> I have a question about mapping for new fields. I already have  
> documents of a type (lets say test\_doc) in an index. Now I want to add  
> a new field ("new") to this document. So far no problem. But what if I  
> decide to not store this field in the source? Can I write a new  
> mapping like
> 
> "test\_doc" : {  
> "\_source" : {  
> "excludes" : ["new"]  
> }  
> }
> 
> and add it to the index? Trying something similar with a new property  
> works, but what about source? Is there a way to achieve my goal at  
> all?
> 
> Thanks,  
> Andrej

---

<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:45am UTC](https://discuss.elastic.co/t/mapping-of-new-fields/6140/4 "2017-07-06T03:45:30Z")

</div>


