【问题标题】:geo_point not mapping correctly in nested modelgeo_point 在嵌套模型中未正确映射
【发布时间】:2015-06-16 20:03:52
【问题描述】:

我正在使用 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}
});

但office映射geo_point结果是一个字符串:

"office": {
      "properties": {
          "location": {
             "properties": {
                 "geo_point": {
                      "type": "string"
                  }
              }
          },

我应该创建映射吗? createMapping 应该是怎样的?

【问题讨论】:

    标签: node.js mongoose mongoosastic


    【解决方案1】:

    如果你还有问题,你应该修改该类型索引的映射:

    http://localhost:9200/log-2015/_mapping/type/ 带 POST

      {
         "type": {
         "properties": {
         "location": {
               "type" : "geo_point"
        }
    

    如果你发现 kibana 中存在冲突问题,只需创建另一个索引

    }

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-07-30
      • 1970-01-01
      • 2019-04-13
      • 2020-10-21
      • 1970-01-01
      • 2020-08-02
      • 1970-01-01
      相关资源
      最近更新 更多