Experiencing problems using root object dynamic template mappings

I'm trying to make use of dynamic templates in my mappings, but there
seems to be a problem when I do so. Curls to duplicate can be found
here: https://gist.github.com/969178

I want to set up a mapping for all "name" fields that appear inside of
the "contact" type. (In the example curls, there is just one such
field- the goal would be to support many nested name objects within my
document.) If I specify the mapping manually, it works exactly as
intended. If, however, I use a dynamic template to define the
mappings, it appears as though it ignores the resulting analyzer
rules. I have done a diff on the mapping both with and without the
dynamic templates, and the only difference between them is the
inclusion of the dynamic_templates property itself. Yet, strangely, I
experience different behavior when I query the same document.

Am I doing something wrong? Or is this a bug?

Heya,

Thanks for the great repro, its a bug. Opened an issue, a fix is in the oven. Mapping: dynamic templates of object type do not initialize some mapping data structures (like analyzers lookup) · Issue #929 · elastic/elasticsearch · GitHub.
On Thursday, May 12, 2011 at 9:50 PM, Ellery Crane wrote:

I'm trying to make use of dynamic templates in my mappings, but there
seems to be a problem when I do so. Curls to duplicate can be found
here: elasticsearch dynamic templates issue · GitHub

I want to set up a mapping for all "name" fields that appear inside of
the "contact" type. (In the example curls, there is just one such
field- the goal would be to support many nested name objects within my
document.) If I specify the mapping manually, it works exactly as
intended. If, however, I use a dynamic template to define the
mappings, it appears as though it ignores the resulting analyzer
rules. I have done a diff on the mapping both with and without the
dynamic templates, and the only difference between them is the
inclusion of the dynamic_templates property itself. Yet, strangely, I
experience different behavior when I query the same document.

Am I doing something wrong? Or is this a bug?