我正在使用 moongosastic 将 mongodb 映射到弹性搜索。
我有一个嵌套模型:
var officeSchema = new Schema({
_id: Schema.ObjectId,
name: String,
location: {
geo_point: {
type: String,
es_type: 'geo_point',
es_lat_lon: true
},
lat: {type: Number},
lon: {type: Number}
}
});
var businessSchema = new Schema({
_id: Schema.ObjectId,
name: {type:String, es_indexed:true}
office: {type:[officeSchema], es_indexed:true}
});
但办公室映射 geo_point 结果是一个字符串:
"office": {
"properties": {
"location": {
"properties": {
"geo_point": {
"type": "string"
}
}
},
我应该创建映射吗?createMapping 应该如何?