yougov / elastic2-doc-manager

Mongo-Connector doc manager for elasticsearch 2.x
Apache License 2.0
104 stars 101 forks source link

mongo-connector removing _id from source. #5

Open ariful-khan opened 8 years ago

ariful-khan commented 8 years ago

here is mongo connector config

{
  "mainAddress": "localhost:27017",
  "oplogFile": "/var/log/mongo-connector/oplog.cs.timestamp",
  "noDump": false,
  "batchSize": -1,
  "verbosity": 1,
  "continueOnError": true,

  "logging": {
    "type": "file",
    "filename": "/var/log/mongo-connector/mongo-connector-cs.log",
    "format": "%(asctime)s [%(levelname)s] %(name)s:%(lineno)d - %(message)s",
    "__rotationWhen": "D",
    "__rotationInterval": 1,
    "__rotationBackups": 10,

    "__type": "syslog",
    "__host": "localhost:514"
  },

  "authentication": {
    "__adminUsername": "username",
    "__password": "password",
    "__passwordFile": "mongo-connector.pwd"
  },

  "__comment__": "For more information about SSL with MongoDB, please see http://docs.mongodb.org/manual/tutorial/configure-ssl-clients/",
  "__ssl": {
    "__sslCertfile": "Path to certificate to identify the local connection against MongoDB",
    "__sslKeyfile": "Path to the private key for sslCertfile. Not necessary if already included in sslCertfile.",
    "__sslCACerts": "Path to concatenated set of certificate authority certificates to validate the other side of the connection",
    "__sslCertificatePolicy": "Policy for validating SSL certificates provided from the other end of the connection. Possible values are 'required' (require and validate certificates), 'optional' (validate but don't require a certificate), and 'ignored' (ignore certificates)."
  },

  "__fields": ["field1", "field2", "field3"],

  "namespaces": {
    "include": ["fa.fa_new_data"],
    "mapping": {
      "fa.fa_new_data": "fa_new_data.new_data"
    },
    "__gridfs": ["db.fs"]
  },

  "docManagers": [
    {
      "docManager": "elastic2_doc_manager",
      "targetURL": "localhost:9200",
      "bulkSize": 5000,
      "uniqueKey": "_id",
      "__autoCommitInterval": null
    }
  ]
}

i am getting like this,

{
"_index": "fa_new_data",
"_type": "new_data",
"_id": "5497c1c4cbb648eb618b4568",
"_version": 1,
"_score": 1,
"_source": {
"checkbox": true,
...........................
}
}

but i want "_id" inside "_source" as well. like this

{
"_index": "fa_new_data",
"_type": "new_data",
"_id": "5497c1c4cbb648eb618b4568",
"_version": 1,
"_score": 1,
"_source": {
"checkbox": true,
"_id": "5497c1c4cbb648eb618b4568",
...........................
}
}

how can I do this ?

llvtt commented 8 years ago

@neconest, there isn't a way to do this right now. Can you provide a reason why _id should also be inside of _source?