0
我試圖使用mongoosastic插件爲NodeJs將現有集合索引到ElasticSearch。這是我的架構:MongoDB與MongoDB的ElasticSearch映射
const callCenterSchema = new mongoose.Schema({
_owner : { type: mongoose.Schema.Types.ObjectId, ref: 'User', es_type: 'object' },
ivrs: [{
name: {
type: String,
es_type: 'string'
},
ivrType: {
type: String,
default: 'mobile',
enum: ['mobile', 'website'],
es_type: 'string'
},
submenu: {
type: [ CallCenterSubmenu.schema ],
es_type: 'nested',
es_include_in_parent: true
}
}]
});
callCenterSchema.plugin(mongoosastic, {
esClient: require('tusla/lib/db/elastic').elastic,
populate: [
{ path: '_owner' }
]
});
let CallCenter = mongoose.model('CallCenter', callCenterSchema);
CallCenter.synchronize()
CallCenter.createMapping(function(err, mapping) {
if (err) {
console.error('Error creating mapping for CallCenters', err.message);
}
});
module.exports = CallCenter;
我的子菜單的模式是這樣的:
const callcenterSubmenuSchema = new mongoose.Schema({
name: String,
key: String,
waitTime: {
type: Number
},
waitSuffix: String,
numberOrLink: String,
auth: {
canBeSkipped: String,
fields: {
type: Array,
es_type: 'object'
},
verification: String,
regExp: String
},
submenu: [this]
}, { _id: false });
我不斷收到此特定錯誤,但未能解決這個問題。我很感激你們能否幫助我。
謝謝!對於CallCenters
錯誤創建映射[mapper_parsing_exception]沒有處理程序類型[混合]現場宣佈[子]
什麼是CallCenterSubmenu.schema? – alpert
我已經在第一個模式下面給出了子菜單模式。 – Yagiz