尝试使用 mongo-connector 进行管道传输时,elasticsearch 6 不允许使用多种类型

elasticsearch 6 not allowing multiple types when trying to pipeline with mongo-connector

我正在尝试使用 mongo-connector 将数据从 mongodb3.6 推送到 elasticsearch6.1。 我的记录是:

db.administrators.find({}).pretty()
{
        "_id" : ObjectId("5701d81893dc484c812b4fc1"),
        "name" : "Test Naupada",
        "username" : "adminn",
        "ward" : "56a6129f44fc869f215fe3fe",
        "password" : "nadmin"
}

rs0:PRIMARY> db.sub_ward_master.find({}).pretty()
{
        "_id" : ObjectId("56a6129f44fc869f215fe3fe"),
        "wardCode" : "3",
        "wardName" : "Naupada",
        "wardgeoCodes" : [],
        "cityName" : "thane"
}

当我使用 运行 mongo-连接器时出现以下错误:

OperationFailed: (u'1 document(s) failed to index.', [{u'index': {u'status': 400, u'_type': u'administrators', u'_index': u'smartjn', u'error': {u'reason': u'Rejecting mapping update to [smartjn] as the final mapping would have more than 1 type: [sub_ward_master, administrators]', u'type': u'illegal_argument_exception'}, u'_id': u'5701d81893dc484c812b4fc1', u'data': {u'username': u'adminn', u'ward': u'56a6129f44fc869f215fe3fe', u'password': u'nadmin', u'name': u'Test Naupada'}}}

有人帮忙吗? 谢谢

ES 6 不允许在任何单个索引中创建 more than one type

mongo-connector 仓库中有一个 open issue 来支持 ES 6。在解决这个问题之前,您应该改用 ES 5。

您可以在 ES6 中为不同的文档类型(即 mongoDB 中的不同集合)创建新索引并使用 -g 标志将其定向到新索引。

例如:

mongo-connector -m localhost:27017 -t localhost:9200 -d elastic2_doc_manager -n {db}.{collection_name} -g {new_index}.{document_type}. 

参考mongo-connector-wiki