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"}

               }
           }
       }
     }                                                         
   ]

Thanks!
Jun

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/fb065b1b-b923-436f-8392-cf9bae6529bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #2