Sam Critchley
Sam Critchley

Reputation: 3778

Elasticsearch rolling upgrade - do deleted documents get removed?

I'm going to upgrade Elasticsearch from 5.6 to 6.8 following the rolling upgrade procedure.

I have an index which is 54,172,622 documents across 5 primary shards, with 1 replica of each. There are 21,696,332 deleted documents in the index.

When I follow the rolling upgrade procedure, will the procedure automatically purge the deleted documents, or is it better to reindex to a new index before upgrading? I assume the upgrade is slower if the deleted documents are included.

Upvotes: 0

Views: 131

Answers (1)

Sandeep Kanabar
Sandeep Kanabar

Reputation: 1302

When I follow the rolling upgrade procedure, will the procedure automatically purge the deleted documents

No, upgrading will NOT modify your docs.count or docs.deleted. The counts will remain the same.

is it better to reindex to a new index before upgrading?

Just because you want to upgrade doesn't mean you need to re-index. It depends. If your index was created in versions prior to 5.x, then you might need to upgrade. The best way to determine this is to run the Upgrade Assistant tool in Kibana. You'll need to reindex some internal indices like .kibana, .security, .tasks, .watches and the Upgrade Assistant will help to reindex those indices. It will also tell you if your main index containing 54,172,622 docs needs to be re-indexed or not. Refer https://www.elastic.co/guide/en/elastic-stack/6.8/upgrading-elastic-stack.html

I assume the upgrade is slower if the deleted documents are included.

I don't think the value of docs.deleted impacts the upgrade process. It's just a count.

Upvotes: 1

Related Questions