Add more retry logic to reindexing

Used to be we'd only retry on document write error.  Now we'll retry on
a query error too!

Change-Id: Ic037f0901984671679a46d1e894f69edee888136
(cherry picked from commit ad34398a01a2b74623fd8c9590c9876e56e72d06)