Closed andymcollins closed 8 years ago
It's a good thing to remove rename the _id field before indexing in elasticsearch, so that is not the issue here. It's probably from the checks being done to ensure that documents really exist in elasticsearch cluster. Will try to replicate that and see what fix can be applied.
@andymcollins this #5 might be a possible fix. Update, test and let me know if it works as it works down here on my machine without any error.
When i remove the _Id from the document using
document = _.omit(document, '_id'); i get message ESMongoSync: Inserted - Index: test Type: external Id: undefined
then when i try to delete a record in MongoDB i get message ESMongoSync: Not Found - Document with id 5728aefd9191198f6ca9991d not found.
if i try to rename the _id field to id with document.id = document._id; i dont get any message to say it has been inserted, and nothing appears in Elasticsearch.
if i convert document_id to string
document.id = document._id.toString(); i get ESMongoSync: Inserted - Index: test Type: external Id: 5728cccbce9cadc97d6ef9b6
but same error when i try to delete ESMongoSync: Not Found - Document with id 5728cccbce9cadc97d6ef9b6 not found.
How do i get the data into Elasticsearch so that any updates/deletes in Mongo are replicated to elasticseach. It seems to just be the ID field. Thanks
this is data i'm adding, id is the renamed string coming from MongoDB
{"processedData":"2016-05-03T14:04:18.948Z", "queue":"AndyJobs", "messageID":"1200319843", "oracleProcessedDate":null, "Details":{"VAC_REF":"1200319843", "JOB_TITLE":"string TEXT HERE", "LOCATION":"Surrey", "AGENCY_ID":18462, "EMP_MKT_CD":"EN", "NeutralForm":"String textr", "Discipline":"Construction", "SubDiscipline":"Water", "RemainingSource":"string"}, "id":"5728aff39191198f6ca9997f"}
Fixed with my latest pull request
HI This is great App.
I have it working for inserting data in mongo and it syncs to Elasticsearch, however in MongoData there is a _id field which it didnt like so i
to the transformFunction, which was ok, but when deleting records from Mongo, it gives error
Is this because the _id has been renamed in elasticseach? Is there a way around this.
Thank you Andy