首页 > 解决方案 > 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.

标签: mongodbelasticsearch

解决方案


我终于用dynamic_templatesas解决了它

"dynamic_templates": [
          {
            "dynTmp": {
              "path_match":   "delStatus",
              "mapping": {
                "type":       "number"
              }
            }
          }
        ],...

推荐阅读