2014-11-14 148 views
1

我對彈性搜索非常陌生,在我使用彈性搜索的節點程序中。在我試圖創建一個"Index Template"但我收到錯誤:彈性搜索索引模板創建

查詢:

client.indices.putTemplate({ 
     "name":"mfi1", 
     "template" : "te*" 
}).then(function(res){ 
    console.log(res); 
}, function(error){ 
    console.log(error); 
}); 

但我收到錯誤:

{ 
    "error": "ElasticsearchParseException[Failed to derive xcontent from [email protected]]", 
    "status": 400 
    } 

幫我解決this.Thanks提前。

回答

3

遐我找到了解決辦法:

我重建我的查詢如下:

{ 
     name : "mfi3", 
     body:{ 
      "template" : "te*", 
      "settings" : { 
       "number_of_shards" : 1 
      }, 
      "mappings" : { 
       "type1" : { 
        "_source" : { "enabled" : false } 
       } 
      } 
     } 
    }; 

其工作的罰款。

+0

這也解決了我的問題,你可以將這個答案標記爲解決方案。 –