Reset Search Index in SharePoint 2013 / 2016 using PowerShell

Problem: SharePoint 2013 search crawling process got stuck, and we got to reset the corrupted search index.

Solution: Follow these steps to reset the search index in SharePoint Server.

  • Go to SharePoint Central Administration >> Service ApplicationsĀ 
  • Pick your Search Service ApplicationĀ 
  • On the Search Administration page, click on the “Index Reset” link under the crawling section of the left navigation menu.
    Reset Search Index in SharePoint 2013
  • In the index reset page, click on “Reset Now” button to reset search index in SharePoint 2013.
Before resetting search index, make sure no search crawls are in progress – Stop all search crawls, disable continuous crawl – otherwise, index reset may get stuck! After index reset, You must run full crawl to enable search results!

PowerShell script to reset index in SharePoint 2013:

At times, you may have to do it with PowerShell for reasons, such as:

  • When you try to reset search index from Web UI, you get timeouts error on large index
  • You may want to partially reset index for only certain content source

Reset search index in SharePoint 2013 with PowerShell:

Here is the PowerShell to reset the search index partially (Reset search index for a specific content source):

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Get Search service application
$ssa = Get-SPEnterpriseSearchServiceApplication

#Content Source Name
$ContentSourceName = "Crescent Portal"

#Get the content source 
$ContentSource = Get-SPEnterpriseSearchCrawlContentSource -Identity $ContentSourceName -SearchApplication $SSA 

#Get Each Start Address
$StartAddresses = $ContentSource.StartAddresses | ForEach-Object { $_.OriginalString } 

#Clear Indexed content starts with custom contnet source
$ContentSource.StartAddresses.Clear()

#Re-add the start address to content source
ForEach ($Address in $StartAddresses ){ $ContentSource.StartAddresses.Add($Address) }

Reset SharePoint 2013 Search Index:
To Reset SharePoint 2013 search index completely using PowerShell, use this cmdlet:

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

Where the $True parameter denotes: Disable Alerts & Ignore Timeout error.

If you still get Timeout errors, Clear SharePoint configuration cache and then try again!

Related post: How to Stop SharePoint Search Crawls

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

Leave a Reply

Your email address will not be published. Required fields are marked *