Fixing degraded search index replica’s in a ginormous search farm

posted in: PowerShell, Search 0

Credit for this post:  Scott Fawley, SharePoint Guru

Here is a handy script that MS sent while troubleshooting a Search issue in a customer’s 2013 Prod farm.  This will show you the state of all partitions and replicas along with the generation that each replica is on.  If one of the replicas is on an older generation then that indicates that it has not been updated properly from the Primary index replica and should be cleaned up (see below for info on doing this).

First create a GetIndexStatus.ps1 using the following code:

Then run:

It should give you an output that looks something like this:

Notice that the generation value us substantially less on this one partition replica than the others.  This was resulting in the customer getting some stale entries in their search results.


To clean this up do the following on the server that the replica lives on:

  1. Stop the following services via Services.msc
  • SharePoint Search Host Controller
  • SharePoint Timer Service
  1. Drill down to the folder where the replica lives.  In this case it was E:\Microsoft Office Servers\15.0\Data\Office Server\Applications\Search\Nodes\7D70D3\IndexComponent6.  Continue to drill down further until you see the data folder. (E:\Microsoft Office Servers\15.0\Data\Office Server\Applications\Search\Nodes\7D70D3\IndexComponent6\storage\data)
  2. Delete the Data folder
  3. Start the SharePoint Search Host Controller and SharePoint Timer Services.
  4. It will take some time for search to connect back to the replica and for it to be rebuilt so just let it run until it is back to healthy.


You may find that there are multiple replicas that are out of sync so just repeat the above on those as well.


Please let me know if you have any questions on the above.