Recently I’ve had a library with roughly 8000 documents and my REST API was failing to find documents that weren’t in the set of first 5000 documents in the library.
SharePoint Online will create indices for you but it will make a guess as to which ones you need, but it might not get this right!
To force SharePoint to create the right indices for you you could probably also create some views that require indices to be set up in a certain way. But that is something for a future post.
One of the many articles on this subject reminded me that I can’t create an index on a library with more than 5000 documents. So the Index on the Title field wouldn’t be created???
Wrong!
I noticed this morning (about 2 days after I created the index) that my queries started to work again!
Therefor a quick advice: Create the indices that you need when things go wrong and wait!