Tag: elasticsearch 5

如何在使用elasticjs v5.0的文档中没有id的情况下自动生成id

我试图添加文件,根据弹性search文件,我们可以添加文件,即使我们不提供身份证… 看到这里 我试图添加一个文件,即使它没有任何ID。 在弹性search中,我该怎么做? 我目前的代码是这样的 var params = _.defaults({}, { index: index, type: type, //'customer' id: data.id || null, body: data }) debug(params) return this.client.create(params); 上面的代码给出了这个错误 {“error”:“无法用这些参数build立path,至less提供索引,types,id”} 任何提示将有所帮助,谢谢