Sometimes the file indexing features in macOS eat up a lot of CPU cycles and disk I/O. Most of the time this is not a problem, but it occasionally gets in the way of other work I am doing.
Here are the commands to turn indexing off (and back on again).
Disable file indexing Link to heading
sudo mdutil -a -i off
Enable file indexing Link to heading
sudo mdutil -a -i on