0
NodeJs 용 mongoosastic 플러그인을 사용하여 기존 컬렉션을 ElasticSearch로 색인화하려고합니다. 이 내 스키마MongoDB with Mongoosastic
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 });
내가이 특정 오류가 계속하지만, 그것을 해결하지 못했습니다. 너희들이 나를 도울 수 있으면 고맙다.
감사합니다.
type: [ CallCenterSubmenu.schema ]
오류 메시지에서이 말한다 : CallCenters에 대한
을 만드는 중 오류 매핑 [mapper_parsing_exception] [혼합] 유형에 대한 어떠한 핸들러가 필드를 선언하지 않습니다 [메뉴] 나는이 문제를 추측
CallCenterSubmenu.schema 란 무엇입니까? – alpert
첫 번째 스키마 아래에 하위 메뉴 스키마를 지정했습니다. – Yagiz