I am using static mapping definitions (i.e. "dynamic" = "false") in
order to have field level control over what fields go into the index.
Reason is that I get rather large documents from the client side and
only need to index a small subset of fields. I now need to support
custom, dynamic fields (marked by a special field name prefix) added
by the client. My plan was to use the dynamic templates feature to
describe the names of dynamic fields and their mapping.
It seems that this approach does not work as dynamic templates only
seem to be applied for dynamic mappings. Is this true? If yes, how can
I limit the dynamic mapping capability to a subset of my fields?
Yes, setting dynamic to false will not enable dynamic templates to basically be executed (as it is considered a dynamic introduction of new mapping). Open a feature request, it can be implemented, though, I think that it might make more sense, if you have control over what is sent over the elasticsearch, to strip the data that is not to be indexed.
Also note, that even though it is not indexed as a dynamic field, it will still be stored in the _source, as the _source is the document sent as is.
-shay.banon
On Monday, January 24, 2011 at 3:57 PM, Jan Fiedler wrote:
I am using static mapping definitions (i.e. "dynamic" = "false") in
order to have field level control over what fields go into the index.
Reason is that I get rather large documents from the client side and
only need to index a small subset of fields. I now need to support
custom, dynamic fields (marked by a special field name prefix) added
by the client. My plan was to use the dynamic templates feature to
describe the names of dynamic fields and their mapping.
It seems that this approach does not work as dynamic templates only
seem to be applied for dynamic mappings. Is this true? If yes, how can
I limit the dynamic mapping capability to a subset of my fields?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.