'Solr Optimization job is not deleting logically deleted documnents

I've two questions:

  1. I've tried optimization with this following command:

curl 'http://hostname:port/solr//update?optimize=true&maxSegments=N&waitSearcher=false'

But when one segment have highest size with live docs and deleted docs both....Solr optimization job is not able to delete those logically deleted docs and also this merges the current segments to resulting segment count with the same deleted doc count as previous.

  1. When already a core have certain segment count, I'm not able to optimize solr core with the same 'maxSegments=N'. Can optimization not be performed with resulting segment count similar to current segment count of a solr core?

Please provide best practices to do this and tell what I'm doing wrong.

Thanks! in Advance.



Solution 1:[1]

Starting with Solr 7.5, there is a change in behaviour of merging segments. Merging segments is what "optimize" does including removal of deleted documents, so you were on the right path. But starting with 7.5 segments are merged only, if certain criteria is fullfilled.

Please review article (found in email thread in Solr community): https://lucidworks.com/post/solr-optimize-merge-expungedeletes-tips/

I had the same issue. After reading the article, I did set "maxSegments=1" and this made "optimize" do the desired job, since this enforces the old behaviour. So it should work with your instance as well, if you specify "maxSegments=1" instead of "maxSegments=N".

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1