To optimize Windows Search Services on a file server with over 10 million files in a single folder, you can use the following approaches:
- Exclude folders: To reduce the number of items that are indexed and to reduce the size of the index database, you can exclude whole folders from the index. To exclude folders from the index, select Settings > Search > Searching Windows > Add an excluded folder. And then select a folder to exclude. For a more granular method to include or exclude items, open Searching Windows, and select Advanced Search Indexer Settings. In Indexing Options, select Modify, and then select or deselect locations to index.
- Change how the Indexer treats specific file types: To control how the indexer treats specific file types, open Indexing Options, and select Advanced > File Types. You can change how the Indexer treats specific file types (identified by file extension) or add and configure new file types.
- Defragment the index database: You can use this approach to reclaim empty space within the index database. Open an administrative Command Prompt window, and then run the following commands in the given order:
net stop wsearch
RD /S /Q %SystemDrive%\ProgramData\Microsoft\Search\Data\Applications\Windows
net start wsearch
- Tune the search service: You can use any of several approaches to improve the performance of Search and the Search Indexer. To make sure that the index reflects your changes, select Settings > Search > Searching Windows > Advanced Search Indexer Settings > Advanced > Rebuild. Let the Indexer run for up to 24 hours to rebuild the index database.
References: