Restoring previous indexes

I see Sphinx has an option to keep the old index files, but what’s the best way to restore these in case in the new indexes some bad data lands in or something like that. Is there a revert rotation?

I assume you talk about the old files that are kept using the unlink=0 option.
There is no built-in option to restore the old versions. It can be done easy manually. There are 2 steps:

  • first rename the old files to have ‘new’ instead of ‘old’ (as they would be a new version, but not rotated yet)
  • send a HUP signal to searchd to trigger a manual rotation.

A quick script (assume you are in the data directory):

for x in *.old.*; do new=$(echo $x | sed -e 's/\.old/\.new/'g);mv "$x" "$new"; done
kill -HUP $(cat  /var/run/sphinx/

Thanks, will try!