2016-04-28 67 views
1

下午好。我最近一直在致力于更新我们的ELK堆栈,并且在升级到ES 2.3.1后一直在动态模板方面出现问题。我在Debian Ubuntu系统上工作,我在/ etc/elasticsearch/templates下的文件中定义了我的模板。如何获取动态模板从文件ES加载2.3.1

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

在我以前的版本1.7.1这工作得很好,我甚至能够使用它来重新索引我所有的旧索引。如果可能的话,我想保留这个外部文件。

谢谢 迈克

回答

1

那是不可能的了,因为2.0.0。这是ES文档here中记录的突变变化。没有替代品,您应该使用_template API。

+0

谢谢@AndreiStefan!不能相信我在网站上没有找到。我在网上搜索了好几个小时。作为后续问题,有没有办法使用_template API导入文件?这可能只是我在使用CURL语句方面缺乏理解。再次谢谢你! –

+0

其实我想到了CURL声明。再次感谢@AndreiStefan –