2014-11-14 151 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

这也解决了我的问题,你可以将这个答案标记为解决方案。 –