Global template for all indices and types


(Wojciech Durczyński) #1

Hello.

Is there a possibility to create a template such that all new types in all
new indices will have a specific mapping?

I'd like to disable analyzing of all string fields.
For particular index/type it's easy to put mapping:
{ "typeName" : {
"dynamic_templates" : [
{
"no_analyze_strings" : {
"match_mapping_type" : "string",
"match" : "*",
"mapping" : {
"type" : "string",
"index" : "not_analyzed"
}
}
}]
}}

But how to define a template cluster-wide that will apply this mapping to
all new types?

Regards
Wojciech Durczyński


(Shay Banon) #2

Create an index template (
http://www.elasticsearch.org/guide/reference/api/admin-indices-templates.html)
matching *, with a single mapping, of type default, with the below
dynamic templates. Should work.

2012/1/11 Wojciech Durczyński wojciech.durczynski@comarch.com

Hello.

Is there a possibility to create a template such that all new types in all
new indices will have a specific mapping?

I'd like to disable analyzing of all string fields.
For particular index/type it's easy to put mapping:
{ "typeName" : {
"dynamic_templates" : [
{
"no_analyze_strings" : {
"match_mapping_type" : "string",
"match" : "*",
"mapping" : {
"type" : "string",
"index" : "not_analyzed"
}
}
}]
}}

But how to define a template cluster-wide that will apply this mapping to
all new types?

Regards
Wojciech Durczyński


(system) #3