Customize field name in dynamic template

(Dionysus1016) #1

Hi All,

Can I customize filed name in dynamic template? For example, I have
fields like "twitter_title", "twitter_body","blog_title","blog_body" , and
there could be more fields with format "xxx_title","xxx_body" which are
added from front-end, then I want mapping "twitter_title" and
"twitter_body"to field “twitter”, mapping "xxx_title" and "xxx_body" to
"xxx", are there any way for this kind of mapping?

I find there are some sample dynamic templates which append string to field
name, but I request to truncate field name..., here is sample to append
string to field name.

dynamic_templates" : [
"string_template" : {
"match" : "*",
"match_mapping_type" : "string",
"mapping" : {
"type" : "multi_field",
"fields" : {
"{name}" : {"type": "string", "index" :
"analyzed", "analyzer" : "default", "store" : "false"},
"untouched" : {"type": "string", "index" :
"analyzed", "analyzer" : "default", "store" : "false"}



You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
For more options, visit

(system) #2