Michael Ferrin
Michael Ferrin

Reputation: 47

How to get dynamic templates to load from file ES 2.3.1

Good afternoon. I have recently been working on updating our ELK stack and have been having issues with dynamic templates once I have upgraded to ES 2.3.1. I am working on Debian Ubuntu system, I have my template defined in a file under /etc/elasticsearch/templates.

{
  "template_1" : {
    "template" : "*",
    "mappings" : {
      "_default_" : {
        "dynamic_templates" : [
          {
            "geoip-location" : {
              "path_match" : "geoip.location",
              "mapping" : {
                "type" : "geo_point"
              }
            }
          },
          {
            "geoip-ip" : {
              "path_match" : "geoip.ip",
              "mapping" : {
                "type" : "string",
                "norms" : { "enabled" : false }
              }
            }
          },
          {
            "level-string" : {
              "match" : "level",
              "mapping" : {
                "type" : "string",
                "norms" : { "enabled" : false }
              }
            }
          },
          {
            "line-string" : {
              "match" : "line",
              "mapping" : {
                "type" : "string",
                "norms" : { "enabled" : false }
              }
            }
          },
          {
            "validanswers" : {
              "match" : "validanswers",
              "mapping" : {
                "enabled" : false
              }
            }
          },
          {
            "jobid" : {
              "match" : "context.jobid",
              "mapping" : {
                "type" : "string",
                "norms" : {"enabled" : false }
              }
            }
          }
        ]
      }
    }
  }
}

In my previous version 1.7.1 this worked fine and I was even able to use it to reindex all of my old indexes. I would like to keep this as an external file if at all possible.

Thank you, Mike

Upvotes: 1

Views: 122

Answers (1)

Andrei Stefan
Andrei Stefan

Reputation: 52368

That's not possible anymore, since 2.0.0. It's a breaking change documented in the ES documentation here. There is no replacement, you should use the _template API.

Upvotes: 1

Related Questions