Resetting Search Index In SharePoint 2013



Search is indeed a mission-critical service application in SharePoint and it’s very important that it remains healthy so that you get the results in the Search Center whenever you execute a search query. However, it’s quite possible that you may notice some errors in the “crawl log” stating that the crawler is not able to crawl the contents in the content source; and at times, it might get even worse such that you may notice all “failures” and no “success” in the crawl logs. In scenarios like that, you might have to reset the search index so the content in the index gets flushed away; after which you need to perform a full crawl so that search index component receives the newly processed items from the content processing component and writes them to the search index. Of course, directly resetting the index is not a fix for any search-related issue. Please ensure that you take all the necessary troubleshooting steps from your end to identify and fix the issue and once you reach a point where nothing really helped, that’s when you should think about resetting the search index.

What happens when you reset the Search Index?

When you reset the search index, all the content will be immediately removed from the search index and users will not be able to retrieve search results when executing a search query on the Search Center. Once you’re done resetting the search index, you must perform a full crawl on one or more content sources to create a new search index. Users will be able to retrieve search results again once the full crawl is finished and the new search index is created. So, in a nutshell, there will be downtime when the search index is getting reset. After a search index reset, the full crawl won't restore all the analytics features that are powered by the Analytics Processing Component. All analytics results will be erased after resetting the search index.

When should we reset the search index?

As I already mentioned above, resetting the search index should be the final step of troubleshooting for any search-related issue. However, based on my experience, this is when we should reset the search index:

  1. Index is corrupted.
  2. One or all index component status is degraded.
  3. You crawl completed successfully but you are not getting the search results.
  4. When you move the index location.
  5. When Index location runs out of space.
  6. In a scenario where we have Index partitions spread across multiple servers and the indexed document count is out of sync. For example, we have 2 servers set as index partitions, server 1 has 150K indexed documents and server 2 has 145k index documents
  7. If we make any changes to search topology.

    1. Removing components 
    2. Adding components
    3. Activating different search topology

Alright! Now, let’s take a look at the steps to reset the search index…

Pre-requisites

Please ensure that you take care of the below mentioned pre-requisites before resetting the search index. Failing to do so will cause adverse effects and as a worst case, you may end up recreating the entire Search Service Application.

  1. Make sure, the crawl status for each content source is “Idle”. If any crawl is running, wait for the crawl to complete or follow the steps to “Stop the active crawls” below.
  2. Make sure, continuous crawl for content sources is disabled [if applicable].This step is only specific to SharePoint 2013 and above.
  3. Make sure, the crawl rate is 0
  4. Make sure, background activity status is “None” on Search Administration page.

Stopping the Active Crawl(s)

  1. Navigate to Search Administration page.
  2. Click on Content Sources link towards your left hand side, as shown in the image below.



  3. If any content source is crawling, click on the dropdown of the content source and click on “Stop Crawl”.

Disable Continuous Crawl

  1. Navigate to Search Administration page.
  2. Click on Content Sources link towards your left hand side, as shown in the image below.


  3. Click on the dropdown and select “Disable Continuous Crawl” to disable it.


  4. Click “OK” when below warning message appears.


  5. Follow the same steps to disable continuous crawl for other content sources. Finally, all the content sources will show “Idle” status, as shown in the image below.

Suspend Search Service Application

This step is to ensure that there is no crawling activity in place while we perform the Index reset.

  1. Open SharePoint Management Shell using service account.
  2. Run the below command.

    Suspend-SPEnterpriseSearchServiceApplication “Search Service Application Name”

    Note

    If you don’t know the name of search service application, you can get it by running the below command before executing the above command.

    Get-SPServiceApplication | Where-Object {$_.TypeName –eq “Search Service Application”}

    After suspending the search application, the Search Administration page will show the status as “Paused for: External request”, as shown in the image below.

Ensure Crawl Rate is 0

  1. Navigate to Search Administration page.
  2. Check the Recent Crawl rate.

Ensure Crawler Background Activity is none,

  1. Navigate to Search Administration page.
  2. Check the status of the Crawler background activity and ensure it shows as “none”, as shown in the image below.

Once the necessary pre-requisites are taken care of, please follow the below steps to perform an Index Reset.

There are 2 ways to perform Index reset.

  • Using UI [User Interface]
    This method can be used when the indexed content in your farm is not much in size i.e. index size is not huge and also when you don’t have large content sources.

  • Using PowerShell
    UI method is not recommended for SharePoint farms with large search index. [i.e. huge count of searchable/indexed documents]. Using the UI method in large farms for resetting the search index can result in time out error. In such cases, we need to use PowerShell method to reset the index.
USING UI
  1. Navigate to SharePoint Central Administration.
  2. Under “Application Management” category, click on “Manage Service Applications”.
  3. Find out “Search Service Application” and click on the Search service application.
  4. In the quick launch, click on “Index Reset”.



  5. Confirm.

USING POWERSHELL

  1. Login to the SharePoint Server using Administrator credentials.
  2. Open “SharePoint management shell” with elevated permissions.
  3. Run the below command to reset search index.

Post Index Reset Steps

  1. Check whether the number of searchable items is 0.
  2. Resume the search service application by running the command shown in the screenshot below.



  3. Enable “continuous crawl” for the content sources if it was enabled prior to index reset.
  4. Run full crawl for the content sources one by one.

This confirms that you’re done resetting the Search index successfully and please keep monitoring the full crawl and ensure that it doesn’t get stuck in the middle. The time duration for the full crawl depends on the size of the content source, if you have very large content sources then it might take days for the full crawl to complete successfully. Once done, please verify the search results and ensure that they return fine. Also check the “Crawl log” and make sure you’re not seeing any errors this time.

Thanks for reading this post …..Happy SharePointing!!!