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!
Discover more from SharePains
Subscribe to get the latest posts sent to your email.
Is your business still running on paper trails, sprawling Excel files, or ageing Access databases? There's a better way — and I can show you exactly what it looks like.
I'm the Technical Director of Vantage 365, a Microsoft solutions consultancy working with clients across the UK, the Netherlands, and worldwide.
For over 30 years I've been turning messy, manual business processes into clean, automated systems that save time, reduce errors, and give teams the visibility they need to make better decisions.
SharePains is not just any blog run by a Microsoft MVP. Have you ever used Try-Catch in Power Automate? The original post about Try-Catch in Power Automate can still be found on this site, https://sharepains.com/2018/02/07/try-catch-finally-in-power-automate-flow/
Or have you ever used the Pieter’s method to avoid variables and speed up your flows? https://sharepains.com/2020/03/11/pieters-method-for-advanced-in-flows/
You can contact me using contact@sharepains.com