Elasticsearch 7.0 Cookbook(Fourth Edition)
上QQ阅读APP看书,第一时间看更新

How it works...

Deleting records only hits shards that contain documents, so there is no overhead. If the document is a child, the parent must be set to look for the correct shard.

There are several additional parameters that can be used to control the delete call. The most important ones are as follows:

  • routing, which allows you to specify the shard to be used for the delete operation
  • version, which allows you to define a version of the document to be deleted to prevent modification of that document
The DELETE operation has to restore functionality. Every document that is deleted is lost forever.

Deleting a record is a fast operation and very easy to use if the IDs of the documents to delete are available. Otherwise, we must use the delete_by_query call, which we will look at in the next chapter.