When Spotlight can’t find one specific file, rebuilding the whole index is a big hammer. mdimport works on just the files or folders you name.
Ask Spotlight to import a folder again, recursively:
mdimport -i ~/Documents/Invoices
The man page says -i requests Spotlight to import the file or recursively import the directory, using the normal mechanisms, with the attributes stored in the index. It’s also what happens if you give no option at all.
The test mode is the part I find most useful for troubleshooting. With -t the file is imported only for a look, nothing is stored, and -d1 prints a summary:
mdimport -t -d1 ~/Documents/Invoices/2026-03.pdf
The output names the importer plug-in that handled the file and how many attributes it returned. If no suitable importer is listed, or very few attributes come back, you know why searching for words inside that file fails. -d2 prints the attributes themselves, except the text content. mdimport -L lists every installed importer.
Know its place. The man page describes mdimport as a tool to test Spotlight plug-ins and re-index files after a new plug-in is installed. If nothing at all shows up in Spotlight, check with mdutil -s whether indexing is on for that volume first; and a folder you put in Search Privacy stays out, however often you import it.
Further reading: mdimport.1 man page, mdutil.1 man page