How update works in Elasticsearch?

Viewed 461

I'm facing an optimization problem on update: I need to understand how the Elasticsearch update mechanics work with their documents in a low level view.

Is it true that Elasticsearch marks as deleted the previous record, without physically deleting it, and rewrites it to a new record, wasting more space than necessary?

2 Answers

Yes, ES uses Lucene under the hood.

So update process is as follows high level

  1. Insert operation
  2. Marked older one for deletion - soft deletion
  3. When Lucene merges segments. It actually deletes the marked documents i.e tombstones.

At high level, how does crud work in ES.

Adding more info to @Gibbs answer, and specific to optimization:

You can utilize the update API with partial doc(send only the field which are changed) to save the n/w bandwidth, however under the hood it will be the complete rewrite of existing doc but if you have large docs then you would save a lot of time in n/w transfer.

Related