Clear The Search Index In SharePoint Server 2016

There are times where we have to reset the search index of SharePoint Search Service. One such instance is a long running crawl, which is stuck at crawling indefinitely. We can clear the index out of the box from the search administration as well as programmatically. Let’s see, how to do it.

We can clear the index from Central Administration by going to the Search Administration page in the Search Service Application. If we click ‘Crawl Log’, we can see the details about the last crawl on the content sources.


Clicking the content source will give the detailed crawl information.


In order to reset the index, go to the Search Administration page.


Clicking on the reset button will clear the indexed results from the search index location. We can also reset the search index, using PowerShell. Spin up SharePoint 2016 Management Shell.


Run the command, given below. 

  1. (Get-SPEnterpriseSearchServiceApplication).reset($true, $true)  

 

This will clear the search index. By going to the crawl log, we can see that it has been cleared.


Once we have cleared the index, we should always run a full crawl. Even if we don’t run a full crawl, the next crawl will always be a full crawl. It does not matter what the crawl schedule is.

Summary

Thus, we saw how to clear the Search Index in SharePoint Server 2016.