您好,我正在使用mongoosastic,当我尝试创建映射时,它显示以下错误
message: '[illegal_argument_exception] Mapper for [content] conflicts with existing mapping in other types:\n' +
'[mapper [content] has different [store] values, mapper [content] has different [analyzer]]',
假设发生错误时我已删除所有索引,我去检查索引,发现他用我指定的设置创建了一个索引,就像他尝试使用默认设置并使用相同的名称创建另一个索引一样但是他找到了第一个创造的,请问
这是我的代码
class Mapping extends EventEmitter {
constructor() {
super();
this._mapping = legalText.createMapping(
{
"settings": {
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "keyword",
"char_filter": [ "my_char_filter" ]
}
},
"char_filter": {
"my_char_filter": {
"type": "html_strip"
}
}
}
},
"mappings": {
"lg_legaltext": {
"properties": {
"content": {
"store": true,
"analyzer": "my_analyzer",
"type": "text"
},
"title": {
"type": "text"
}
}
}
}
}, function(err, mapping) {
if (err) {
console.log(err);
} else {
console.log(mapping);
}
});
this._listen();
}
get mapping() {
return this._mapping;
}
_listen() {
let stream = legalText.synchronize();
let count = 0;
logger.info("before event data");
stream.on("data", function(){
count++;
});
stream.on("close", function(){
logger.info("number of legal texts indexed with ES is : ", count);
});
stream.on("error", function(err){
logger.warn("there been an error", err);
});
}
}
module.exports.elastic = new Mapping();