mongodb - MongoConnector mapper_parsing_exception with elasticsearch from Mongodb
问题描述
I am using mongo connector and transporting entire collections from mongodb to elasticsearch.
The mongo-connector config json file is:
"mainAddress": "localhost:27017",
"verbosity": 1,
"continueOnError":false,
"logging": {
"type": "file",
"filename": "mongo-connector.log"
},
"namespaces": {
"include": ["dev-db.*"]
},
"docManagers": [
{
"docManager": "elastic2_doc_manager",
"targetURL": "localhost:9200",
"__bulkSize": 1000,
"__uniqueKey": "_id",
"__autoCommitInterval": 0,
"args": {
"clientOptions": {
"timeout": 100
}
}
}
]
It starts out fine but after a certain point, in a particular collection say dummy_coll, the log indicates this:
u'delStatus': True, u'email': u'priyanka@chopra.com'}}}, {u'index': {u'status': 400, u'_type': u'dummy_coll', u'_index': u'dev-db', u'error': {u'caused_by': {u'reason': u'Current token (VALUE_FALSE) not numeric, can not use numeric value accessors\n at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper@739b2b14; line: 1, column: 471]', u'type': u'json_parse_exception'}, u'reason': u'failed to parse [delStatus]', u'type': u'mapper_parsing_exception'},
which says I have a parsing issue with delStatus. However I have only true or false present in the same field. I have a very little idea how it works. Any suggestion will be really helpful.
解决方案
我终于用dynamic_templates
as解决了它
"dynamic_templates": [
{
"dynTmp": {
"path_match": "delStatus",
"mapping": {
"type": "number"
}
}
}
],...
推荐阅读
- php - 我想在我的 html 脚本中加载一个 php 页面
- python - 使用 Python 从字符串中删除度数符号
- swift - 使用 Moya 刷新身份验证令牌
- aws-lambda - AWS Lambda 不擅长生成随机数?
- java - 在处理大数据时,如何确保您的代码按预期工作?
- flask - 使用 Marshmallow 对多种格式进行序列化/反序列化
- sql - Oracle 中的查询不遵守 AND 和 WHERE 条件
- r - R 3.5.2:从动物园加载库存数据时出错
- functional-programming - lodash/fp 范围的不同行为
- webpack - webPack 开发服务器代理重写 URL 以响应