Disable Mapping for core types like string,long


(Saiprasad Mishra) #1

I am on 1.3.2 version of ES

I have a requirement for disabling some core type fileds in some objects (neither index nor put it in mapping)

Is there anyway to remove a string field from mapping in a dynamic template where for e.g a.myobj.*.values.attributeId ( * could be brand,color etc as an object in this example) should not be mapped apart from just saying index="no" to avoid the mapping file to grow very large.

"enabled" : false is working only for an object type.

Any help much appreciated

Regards
Sai


(Radu Gheorghe) #2

Hello Sai,

I did some tests (with ES 1.6) and the only solution I see is to define the mapping statically (i.e. each time you need a new field, append it to the mapping) and set dynamic to false. If a document has a field that's not defined in the document, it will still be in _source, but it won't be added to the mapping (and of course not indexed or stored separately).

With dynamic mappings, I couldn't find a solution. As you said, enabled=false doesn't work for core types and if you combine dynamic=false with dynamic_templates, then dynamic=false takes over, and dynamic templates are ignored.

Best regards,
Radu


(system) #3