0

我正在使用 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 应该如何?

4

1 回答 1

0

如果您仍然有问题,您应该修改该类型索引的映射:

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

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

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

}

于 2015-06-16T12:03:52.627 回答