Avinash Kumar Pandey
Avinash Kumar Pandey

Reputation: 752

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?

Upvotes: 36

Views: 31216

Answers (1)

Vineeth Mohan
Vineeth Mohan

Reputation: 19253

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.

Upvotes: 45

Related Questions