来自Mongodb的带有Elasticsearch的MongoConnector mapper_parsing_exception

时间:2018-09-04 15:04:34

标签: mongodb elasticsearch

我正在使用mongo连接器,并将整个集合从mongodb传输到elasticsearch。

mongo-connector配置json文件为:

    "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
                }
        }
        }
    ]

它可以正常运行,但是经过一定时间后,在特定集合中,例如dummy_coll,日志表明了这一点:

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'},

这表示我在delStatus中遇到解析问题。但是,我在同一个字段中只有对或错。我几乎不知道它是如何工作的。任何建议都会很有帮助。

1 个答案:

答案 0 :(得分:0)

我终于使用dynamic_templates作为

解决了它
"dynamic_templates": [
          {
            "dynTmp": {
              "path_match":   "delStatus",
              "mapping": {
                "type":       "number"
              }
            }
          }
        ],...