Why SharePoint Search REST API TotalRows Changes and How to Fix It
Question details
The user is seeking to understand why the TotalRows property in SharePoint Online Search REST API fluctuates for identical queries.

- Product
- SharePoint Online Search REST API
- Device & OS
- not provided
- Scenario
- Custom SharePoint development using SPFx and React where exact search result counts are needed.
- Observed behavior
- The Search REST API returns varying TotalRows values for the same query, even without underlying data changes, and setting TrimDuplicates to false does not stabilize the count.
Verify your query parameters and confirm that your SharePoint tenant's search index is not currently undergoing a background crawl or synchronization.
Consult the Microsoft Q&A Developer Community
Since this involves core SharePoint search engine estimation algorithms and custom SPFx/React development, reaching out to Microsoft engineers is the most effective approach.
The TotalRows value in SharePoint Search is generally an estimate optimized for performance rather than a strict count. Addressing complex scenarios around this behavior requires advanced developer support from Microsoft.
Open your web browser and go to the official Microsoft Q&A forum at learn.microsoft.com/en-us/answers/questions/.
Log in using your Microsoft Developer or corporate Office 365 credentials.
Click the 'Ask a question' button. Clearly describe your SPFx and React setup, provide your REST API query structure, and mention that TrimDuplicates did not fix the TotalRows fluctuation.
Ensure you apply the 'SharePoint Development' tag to your post so that specialized Microsoft engineers and community experts can locate and address your query.

Document Your Code Architectures with WPS Office
While resolving complex SharePoint REST API development issues, you need a reliable suite for documenting your code, queries, and project architectures. WPS Office provides a free, lightweight, and highly compatible alternative to Microsoft Office, ensuring seamless document management without heavy system overhead.
- 1. Visit the official website: Go to the official WPS Office website to access the latest version.
- 2. Download the installer: Click the 'Free Download' button tailored for your operating system.
- 3. Install the software: Run the downloaded installer and follow the on-screen instructions to complete the setup.

Frequently Asked Questions
Why does TrimDuplicates=false not fix the TotalRows issue?
In SharePoint Search, TotalRows is designed as an estimate to maximize query performance across large datasets. Disabling TrimDuplicates reveals hidden duplicate items but does not override the fundamental estimation algorithms used by the search index.
Is TotalRows guaranteed to be accurate in SharePoint Online?
No. The SharePoint Search REST API typically provides an estimated TotalRows count. For queries returning massive result sets, calculating the absolute exact number of matching rows would drastically degrade performance, so an approximation is returned instead.
What is the best alternative to using TotalRows for exact counts?
If a precise count is strictly required for your React application, developers often need to page through the results iteratively or use specific CAML queries against targeted lists. However, note that these alternatives can be significantly slower than relying on the Search index.




