I discovered that Windows Search was taking approximately 139GB (out of the 300GB) on my system drive, and decided to look for ways to tame it a bit. These are my notes as reference (and for future setups).
I’m not sure if I’m typical but in reality I hardly ever search my system from Windows directly. If I could, I would probably try to disable the entire Windows search but I do use OneNote and Outlook, and I think minimally that needs Windows search to work. Also, I sometimes type in a command in the Windows menu and it helps that it can find a program that I want to use.
When I noticed it, the index, Windows.edb
was 139GB and had indexed more than 2 million files.
So, in short:
- I want to leave Wndows search on
- I want to severely limit what it indexes
- I want OneNote, Outlook and a couple of other things to have functional search
- I do not want it to be able to do full-text search in my text files, CSV data files, source code files, etc.
- I want a more reasonable file size for Windows search files, especially on the system drive
Let’s get started! In trying to make Windows search a bit more efficient, we can:
- move the file to a different disk
- Defragment the file (note: it needs a lot of space)
- Change the areas it indexes
- Change what information it stores about the file types (extensions) it is indexing.
Move the files
The easiest way to move the files is to use the Indexing Options
in Windows. Go to Control Panel > Indexing Options and click on Advanced Options and see the information in the Index Settings tab.
Click on Select new and browse to a new path where you would like to move the file. Depending on the size of the files, it might take some time and will create a folder and move a bunch of files across. In my case, I needed this to have enough space to be able to defragment the file.
Defragmenting the file
There are a few commands to use for this. You need to start a Windows command prompy with Administrator privilege and do the following.
sc config wsearch start=disabled
sc stop wsearch
esentutl.exe /d %ProgramData%\Microsoft\Search\Data\Applications\Windows\Windows.edb
sc config wsearch start=delayed-auto
sc start wsearch
In my case, it took a lot of space to do this! It needed another 139GB of space on C Drive since it used that to defragment the data (this went into c:\windows\system32
) and it took approximately 1hr to get done. Was it worth it? For me, yes! The file size came down from 139GB to 180MB (yes, the first one is “G” and the second one is “M”).
Don’t index file contents
From the Advanced option, I was able to get change Windows search from indexing the file contents to indexing only the file properties. Here is a list of extensions for which I changed it I feel that I could probably remove a lot of other extensions from being indexed at all because I don’t think I use the features.
Index Properties Only:
- asc
- ascx
- asm
- asp
- aspx
- asx
- bas
- bat
- bcp
- c
- cc
- cls
- cmd
- cpp
- csproj
- css
- csv
- cxx
- dos
- ext
- faq
- h
- hpp
- hta
- htm
- html
- htt
- htw
- htx
- hxx
- idl
- idq
- jav
- java
- js
- lgn
- pl
- rc
- rul
- s
- sql
- stm
- tab
- txt
- wbk
- wiz
- wri
- wtx
- xlb
- xlc
- xls
- xlsb
- xlsm
- xlsx
- xlt
- xml
- xsd
- xsl
- xslt
- zip
Select the locations you index
The Indexing Options page shows the locations that are being indexed. You can tune these to places that make sense for you. I removed most of the locations, e.g., D Drive (my personal data drive) and a lot of other locations to reduce the areas that are searched for data. Click on Modify to adjust the locations, and once it opens the list, remember to click on Show all locations to ensure that you can see the full list and select or remove locations that do not matter to you.
Note: It is important that you do not exclude OneNote and Outlook if you want to be able to do any search in those applications.
Rebuild the index file
You can ask Windows Search to rebuild the file. I changed what it should do for different extensions and then it rebuilt the index. The final file size dropped from 180MB to 163MB.
Conclusion and References
These steps certainly helped me in my immediate problem. Let’s see if it makes things better or worse for me. I would also recommend that you do regular housekeeping by rebuilding the index or defragmenting the file every now and then. You could consider monitoring the file size and setting up an alert for when it grows too much. Here are some of the posts and sites that I read and found most helfpul:
- There is some background here on how Windows search works and how you can tune it: https://answers.microsoft.com/en-us/windows/forum/all/what-are-the-best-windows-search-configuration/1460005d-4f79-49d8-8280-b62dd582317b
- This is very helpful also: https://techpros.helpspot.com/index.php?pg=kb.page&id=35