Elasticearch Bulk Index - Update Only If Exists

I use the Elasticsearch Bulk Index to update some data about documents, but it may happen that the document I'm trying to update does not exist - in this case I want it to do nothing.

I do not want him to create a document in this case.

I didn’t find anything in the docs or maybe missed it.

My current actions (in this case it creates a document):

{ update: { _index: "index1", _type: "interaction", _id: item.id } }, { script: { file: "update-stats", lang: "groovy", params: { newCommentsCount: newRetweetCount, } }, upsert: normalizedItem } 

How to update a document only if it exists, otherwise nothing?

thanks

+5
source share
1 answer

Do not use upsert and use regular update. In addition, if the document does not exist during the update, the update will not be performed. There it should work well for you.

0
source

Source: https://habr.com/ru/post/1247618/


All Articles