Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is it possible update item if this item with id exists? #80

Open
heilwood opened this issue Jan 7, 2020 · 2 comments
Open

is it possible update item if this item with id exists? #80

heilwood opened this issue Jan 7, 2020 · 2 comments

Comments

@heilwood
Copy link

heilwood commented Jan 7, 2020

Is it possible update item if this item with same id already exists in elastic instead of adding new one? I mean:
{
itemId: 1,
color: ['red', 'blue']
}
{
itemId: 1,
color: ['green']
}

result:
{
itemId: 1,
color: ['red', 'blue', 'green']
}

@jrayu
Copy link

jrayu commented May 27, 2020

did you set a uniq field?

@jrayu
Copy link

jrayu commented May 27, 2020

just roughly read the code, you would find the _id field is a hash of your unique fields. i guess the same unique fields together would lead you to the same id. with the python elasticsearch.index api it updates the entry if the id is specified and exists in the database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants