Is there Any way to perform mongodb's $addToset like operation in elasticsearch while creating an document to elastic search

Like If there is document which is already existing it will add some value to a array field, and if it doesnt exist it will create a new_one?
Ex.:-

{
'name': 'john doe',
'age': 12,
'books': ['x', 'y']
}

now if a document with this name already exists the query should add books to books field or it should create a new one

Hey! I found my answer in official documentation.

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