Dynamic template for all types


(jacorob) #1

If I understand the dynamic template examples correctly (http://
www.elasticsearch.org/guide/reference/mapping/root-object-type.html)
it appears that you need to specify the type that the dynamic_template
applies to.

For example,
{
"person" : {
"dynamic_templates" : [
{
"store_generic" : {
"match" : "*",
"mapping" : {
"store" : "yes"
}
}
}
]
}
}

This limits the dynamic template to the "person" type. Is there a way
to specify a dynamic template that will apply to all types? Something
akin to the "_all" option when specifying the index/inidices that the
template will apply to.

The reason I ask is because I create new types on the fly. I can add a
new dynamic mapping each time I create a new type, but I was hoping
there was a feature I was missing.

Thanks,
Bob


(jacorob) #2

Of course, as soon as I sent this I figured out what I needed. I just need
to specify "default" for the type.

Bob

On Wed, Apr 27, 2011 at 10:09 AM, Bob jacorob@gmail.com wrote:

If I understand the dynamic template examples correctly (http://
www.elasticsearch.org/guide/reference/mapping/root-object-type.html)
it appears that you need to specify the type that the dynamic_template
applies to.

For example,
{
"person" : {
"dynamic_templates" : [
{
"store_generic" : {
"match" : "*",
"mapping" : {
"store" : "yes"
}
}
}
]
}
}

This limits the dynamic template to the "person" type. Is there a way
to specify a dynamic template that will apply to all types? Something
akin to the "_all" option when specifying the index/inidices that the
template will apply to.

The reason I ask is because I create new types on the fly. I can add a
new dynamic mapping each time I create a new type, but I was hoping
there was a feature I was missing.

Thanks,
Bob


(system) #3