Moving Search Index

There will be times where the Search is either on the wrong server, or you want to move the index on another drive. There have been times where I’ve done this in the past, but I think the mistake I’ve made is deleting the old index at the same time as creating the new index. In this demonstration, I allow the new and old index to live at the same time, in order to sync the index between the two. After the sync is complete, you can THEN remove the old index location/server and reset the topology.

Add-pssnapin microsoft.sharepoint.powershell

$serv1 = Get-SPEnterpriseSearchServiceInstance -Identity "SPAPP1"

$serv2 = Get-SPEnterpriseSearchServiceInstance -Identity "SPAPP2"

$ssa = Get-SPEnterpriseSearchServiceApplication

$active = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active

$clone = New-SPEnterpriseSearchTopology -SearchApplication $ssa -Clone -SearchTopology $active

 

New-SPEnterpriseSearchIndexComponent -SearchTopology $clone -SearchServiceInstance $serv2 -IndexPartition 0 -RootDirectory "D:\Index"

 

Get-SPEnterpriseSearchComponent -SearchTopology $clone -SearchApplication $ssa

Set-SPEnterpriseSearchTopology -Identity $clone

 

Get-SPEnterpriseSearchStatus -SearchApplication $ssa

 

#The “Degraded” Status just means that the index is syncing between the existing index and the new index.

#Once the Index is “Active” begin to remove the old index

 

#Get Index GUID of old index

Get-SPEnterpriseSearchComponent -SearchTopology $clone -SearchApplication $ssa

 

#Removing the old index and setting topology to a clone without the old index

$ssa = Get-SPEnterpriseSearchServiceApplication

$active = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active

$clone = New-SPEnterpriseSearchTopology -SearchApplication $ssa -Clone -SearchTopology $active

Remove-SPEnterpriseSearchComponent -Identity GUID_OF_Index_Component -SearchTopology $clone

Set-SPEnterpriseSearchTopology -Identity $clone

 

Once the index is sync’d and online, you should be good to go!

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s