Creating a template and setting fields to 'not_analyzed'


(Maria Delarosa) #1

I am able to succesfully create a template from sense. However, I am trying to set two fields application and hostname to not_analyzed. The below only works for one field e.g. "match": "application" or "match": "hostname". However, I cant get them both set to not_analyzed by doing "match": ["application", "hostname"]. Any idea how I can set in the template both application and hostname to be not_analyzed?

PUT _template/mytemplates
{
    "order":0,
    "template":"mytemplates*",
    "settings":{
        "index.refresh_interval":"5s"
    },
    "mappings":{
        "logs":{
            "dynamic_templates":[
                { 
                  "my_string_fields":{
                      "match": ["application", "hostname"],
                      "match_mapping_type":"string",
                      "mapping":{
                          "type":"string",
                          "index":"not_analyzed",
                          "omit_norms" : true,
                          "norms":{
                              "enabled":false
                          }
                      }
                  }
                }
            ]
        }
    }
}

(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.