Mapping of new fields

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

Hi,

I think this can help you Elasticsearch Platform — Find real-time answers at scale | Elastic
(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

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
.

On Tue, Dec 13, 2011 at 4:46 PM, Andrej Rosenheinrich <
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