hi guys
let's say, i have documents with two fields - field1 and field2
i want to create a new document if it doesn't exist, and update it if it exists, but if new document is the same as existing one, i want to "noop" happen, so no real update will run in ES. it can be done by _update
API with "doc_as_upsert" = true.
but the problem is that if i put a document with only 1 field specified, like {"field1": "val"}
, then only this field is updated, not the whole document. an if field1 is already set to "val1" but existing document also has "field2" field, then nothing happens as well, returning "noop" as result. whereas i want in this case to update existing document so now it has only 1 field. is it possible?
so i want exactly the same behavior as "index" API, but if new document is exactly the same as existing one, then do nothing (noop) to avoid having a lot of deleted documents in segments.
thanks in advance for help