Simple rails rake task refuse to run with error "Don't know how to build task", why?
Rename your file to reindex.rake
and it should work.
Related: How to build task 'db:populate'
You can also get this error if you forget to put the namespace before your task name. (i.e. :reindex instead of db:reindex)
The file extension for rake tasks must be '.rake'.
If you named your file as '.rb', then rake will not find it, and you will question your own sanity for several minutes before ending up here.