Reputation: 4330
I have an index with the following docs.count
and docs.deleted
.
docs.count = 2762694
docs.deleted = 2508162
Is docs.count
the total number of documents in disk including the ones marked as deleted?
Or is the total number of documents in disk is docs.count
+ docs.deleted
?
UPDATE: To clarify my concern, if docs.count
also include the docs.deleted
in it, then in the above example about 90% of the documents are deleted. But on the other hand the docs.deleted
is not counted as part of docs.count
and they are additional then only 47% of the documents are deleted. Based on this I can decide how important it is to use force merge.
Upvotes: 5
Views: 3585
Reputation: 1676
No.
The docs.count
does not include the docs.deleted
.
docs.deleted
are the documents that are marked for deletion by elasticsearch.
I don't know the exact operation you are performing but the docs.deleted
can be this high even when you update a lot of your documents. As elasticsearch doesn't update the document in-place but deletes the older one and replaces it with the newer one.
Upvotes: 4
Reputation: 217274
The counts you see in the _cat/indices
API response are counts at the Lucene level, so docs.count
also includes hidden nested documents.
docs.deleted
are indeed documents marked as deleted but not yet expunged.
If you want a real count of your documents you should use the _cat/count
API which provides a clean count that indicates the number of live documents and does not include deleted documents which have not yet been cleaned up by the merge process.
Upvotes: 8