Updating index through postgres

HI..
I'm using elasticsearch 2.4 with postgres DB as data source. I'm indexing data into elasticsearch through a view in my postgres DB. When a new record added into DB, its getting indexed properly and I'm able to search that in elasticsearch. But if I change any value in the existing record, its getting indexed again as a new document instead of updating the old one.So its being duplicated when search for the same.
What will be the solution for this.?Can anyone help me out.?

If you use the postgres row id (you have a primary key?) as the ES _id, you shouldn't see duplicates.

Thank you..But how can I add it into '_id'.I never tried this before. Thanks in Advance

Please see https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-id-field.html .

You are being sparse how you really index the data so without more information about your actual setup I'm unable to further assist.

Thanks a lot..:slight_smile:

Have tried to add my primary key in '_id' but its not working. When I searched regarding this I got like _id is no longer configurable since elasticsearch 2.0.
So what can I do now.:confused:

_id is exactly what I'm using in my code. Did you try to provide it explicit in your mapping? I don't think you need to do so. Just index the field _id and it should be fine (depending on how you actually do this, see below).

You still failed to disclose any further helpful information. Even when you say "I searched... I got like" you fail to provide the reference (though I don't think you want "configurable id" anyway to your solution?).

Please, if you want to be helped: provide references, explain your approach in more detail, show maybe pseudo-code or indices or mapping or anything so people can stop making guesswork for you.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.