Using MongoDB IDs as ES document IDs


(James Carr) #1

Hi All,

I recently have been working on a Mongoose plugin to index MongoDB
documents in Elasticsearch and wanted to use the same IDs across both but
ran into some errors. I'll be able to investigate further when I get home
as I don't recall the exact error but I am wondering if anyone has
experienced this?

For now I just store the MongoDB id as _mongoId in the elastic search
document.

Thanks,
James


(Shay Banon) #2

You should be able to simply store the mongo id it as a string...

On Tue, Jun 19, 2012 at 6:53 PM, James Carr james.r.carr@gmail.com wrote:

Hi All,

I recently have been working on a Mongoose plugin to index MongoDB
documents in Elasticsearch and wanted to use the same IDs across both but
ran into some errors. I'll be able to investigate further when I get home
as I don't recall the exact error but I am wondering if anyone has
experienced this?

For now I just store the MongoDB id as _mongoId in the elastic search
document.

Thanks,
James


(benny.sadeh) #3

doing the very same thing and haven't bumped into any problems.
can you be more specific about what sort of problems are you running into?

On Tuesday, June 19, 2012 9:53:00 AM UTC-7, James Carr wrote:

Hi All,

I recently have been working on a Mongoose plugin to index MongoDB
documents in Elasticsearch and wanted to use the same IDs across both but
ran into some errors. I'll be able to investigate further when I get home
as I don't recall the exact error but I am wondering if anyone has
experienced this?

For now I just store the MongoDB id as _mongoId in the elastic search
document.

Thanks,
James


(James Carr) #4

To quote what has probably been said may times on the internet, "I was
doing it wrong." :slight_smile:

Thanks,
James

On Thu, Jun 21, 2012 at 11:11 PM, benny.sadeh benny.sadeh@gmail.com wrote:

doing the very same thing and haven't bumped into any problems.
can you be more specific about what sort of problems are you running into?

On Tuesday, June 19, 2012 9:53:00 AM UTC-7, James Carr wrote:

Hi All,

I recently have been working on a Mongoose plugin to index MongoDB
documents in Elasticsearch and wanted to use the same IDs across both but
ran into some errors. I'll be able to investigate further when I get home
as I don't recall the exact error but I am wondering if anyone has
experienced this?

For now I just store the MongoDB id as _mongoId in the elastic search
document.

Thanks,
James


(system) #5