This time it successfully rebuilt all the data but then timed out while waiting for the optimize operation to complete:
Optimizing...Elasticsearch failed in an unexpected way. This is always a bug in CirrusSearch.
Error type: Elastica\Exception\Connection\HttpException
Message: Operation timed out
#0 /usr/local/apache/common-local/php-1.23wmf15/extensions/Elastica/Elastica/lib/Elastica/Request.php(166): Elastica\Transport\Http->exec(Object(Elastica\Request), Array)
We should set the timeouts for all reindexing actions to something stupid long because this is a manual operation taken by an administrator.