Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does the field docs.deleted mean in elasticsearch _cat/indices API response?

Here is the index statistics.

Avinashs-MacBook-Pro:~ avinashpandey$ curl 'localhost:9200/_cat/indices?v'

health status index            pri rep docs.count **docs.deleted** store.size pri.store.size 

yellow open   sitemonitor-5min   5   1    8151707       **221036**      1.2gb          1.2gb 

I am sure I have only been doing HTTP Post at /index/type/_id and have not deleted a single document. Where do these deleted docs come from then?

like image 946
Avinash Kumar Pandey Avatar asked Dec 29 '14 08:12

Avinash Kumar Pandey


People also ask

What happens when you delete an Elasticsearch index?

Deleting an index deletes its documents, shards, and metadata. It does not delete related Kibana components, such as data views, visualizations, or dashboards.

Does deleting index in Elasticsearch delete data?

Yes, deleting the index, deletes all the data in that index.

How do I list documents in an index Elasticsearch?

Elasticsearch will get significant slower if you just add some big number as size, one method to use to get all documents is using scan and scroll ids. The results from this would contain a _scroll_id which you have to query to get the next 100 chunk. This answer needs more updates. search_type=scan is now deprecated.

How do I delete all indices in Elasticsearch?

To delete all indices, use _all or * . To disallow the deletion of indices with _all or wildcard expressions, set the action. destructive_requires_name cluster setting to true .


1 Answers

A overwrite ( An index operation on existing document ) or an update operation also does delete in background.

Due to immutability of segments in Lucene index , deletion operation is not exactly possible easily. For any change to the original document operation , like reindex or update , it needs to delete the document , mark it as deleted and create a new document with the change , in the background.

You are seeing this delete because you might have used UPDATE API or written a document to a doc ID which already exist.

like image 146
Vineeth Mohan Avatar answered Oct 21 '22 15:10

Vineeth Mohan