Elasticsearch Bridge 和 MongoDB IndexAlreadyExist 具有自定义映射

Elasticsearch Bridge and MongoDB IndexAlreadyExist with custom mapping

这几天我遇到了我无法解决的问题:

我想要发生的事情: 我得到了一个集合,应该通过 https://github.com/richardwilly98/elasticsearch-river-mongodb 转移到 elasticsearch 在我创建河流之前,我设置了索引的自定义映射,这样我就不会得到可以在 elasticsearch 中使用 geo_point 类型的动态映射。

所以首先是 Mongodb 中的模型:

screenName: { type: String, required: true, unique: true, sparse: true },
firstName: { type: String, validate: isString, index: true },
lastName: { type: String, validate: isString, index: true },
deleted: { type: Number, index: true, default: 0 },
homeBase: {
    type: {
        type: String,
        default: 'Point'
    },
    coordinates: [Number] // [<longitude>, <latitude>]
},
realTime: {
    type: {
        type: String,
        default: 'Point'
    },
    coordinates: [Number] // [<longitude>, <latitude>]
}

RealTime 和 homeBase 是 2dSpheres

预映射

{
"settings": {
    "mapper": {
        "dynamic": false
    }
},
"mappings": {
    "default": {
        "properties": {
            "firstName": {
                "type": "string"
            },
            "lastName": {
                "type": "string"
            },
            "screenName": {
                "type": "string"
            },

            "homeBase": {
                "type": "object",
                "properties": {
                    "coordinates": {
                        "type": "geo_point"
                    }
                }
            },
            "realTime": {
                "type": "object",
                "properties": {
                    "coordinates": {
                        "type": "geo_point"
                    }
                }
            }
        }
    }
}

Wich 也很好用并被编入索引 Url 调用 PUT localhost:9200/users

现在是河流

{
"type": "mongodb",
"mongodb": {
  "servers": [
    {
      "host": "localhost",
      "port": "27017"
    }
  ],
  "options": "drop_collection",
  "db": "entities",
  "collection": "users"
},
"index": {
  "name": "users",
  "type": "documents"
}
}

这里我调用了 PUT http://localhost:9200/_river/users/_meta 我收到的是 { "error" : "IndexAlreadyExistsException[[users] already exists]", "status" : 400 }

我需要这个做什么?做像

这样的查询
GET _search
{
"query": { 
"filtered": {
   "query": {
       "multi_match": {
                                "query": "mario",
                                "fields": ["firstName", "lastName",     "specialities"]
                            }
    },
    "filter" : {
        "mutate" {
         "convert" => { "homeBase.coordinates" => "geo_point"}   
        },
        "geo_bounding_box" : {
            "homeBase.coordinates" : {
                "top_left" : [1,100],
                "bottom_right" : [1,100]
            }
        }
    }
}
}
}

我获取位置字段的标准方式是双精度,如果有人知道查询双精度坐标周围位置的方法,那也很好。

请帮忙!

Mongodb:2.6.5 河流 2.0.4 弹性搜索:1.4.0

我使用Put而不是Post来创建River,这导致出现奇怪的错误,没有索引的文件。

我改成POST一切正常