Mapping template for one raw field


(Michal) #1

Hi,

I want to create mapping template for my index - lets name it testindex-*
The main goal is to create raw field with not_analyzed value for ONE field.
Rest of the fields i want to create by sending them by logstash without mapping tamplete for them. How can I do that? PLEASE help :frowning:


(Michal) #2

Ok. I got it:

curl -XPUT 'localhost:9200/_template/template_1?pretty' -d'
{
"template" : "testindex-*",
"mappings" : {
"default" : {
"dynamic_templates" : [
{
"string_fields" : {
"match" : "name_of_field",
"mapping" : {
"type" : "string", "index" : "analyzed",
"fields" : {
"raw" : {"type": "string", "index" : "not_analyzed"}
}
}
}
}]
}
}
}'


(system) #3