2016-04-28 29 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 –