1

I am trying to create the Elastic search dynamic template with respect to index type (by date, index will be created by date pertition) My sample index URL will be :

http://localhost:9200/my_index/day-01-01-2016
http://localhost:9200/my_index/day-02-01-2016
....

Sample template is as follows:

PUT my_index
{
  "mappings": {
    "day-*": {          //here, we can't use wild card for index types
      "dynamic_templates": [
       {
          "strings": {
            "match_mapping_type": "string",
            "mapping": {
              "type": "string",
              "fields": {
                "raw": {
                  "type":  "string",
                  "index": "not_analyzed",
                  "ignore_above": 256
                }
              }
            }
          }
        }
      ]
    }
  }
}

What is the way to create the template for index types: "day-*"

1 Answers1

0

It is working: My default index is as follows:

   curl -XPUT localhost:9200/test_index -d '
{
  "mappings": {
    "_default_": {  
      "dynamic_templates": [
        { "my_dtemplate": { 
            "match_mapping_type": "string",
            "mapping": {
              "type": "string",
              "index": "not_analyzed",
              "doc_values": true
            }
        }}
      ]
    }
  }
}'