Move search index location

When you install SharePoint 2013 there is no option to change the default search index location (like the ULS log folder). If (like us) you keep your default c drive small and only allocated for installations it can cause some issues with size as the search index grows.

Unfortunately there is no config or easy way to change the location. In effect you need to copy\clone the search service application and use a new location and then delete the old one…all via Powershell:

Get the current Search topology
$ssa = Get-SPEnterpriseSearchServiceApplication “Search Service Application”
$instance=Get-SPEnterpriseSearchServiceInstance -Local
$current=Get-SPEnterpriseSearchTopology -SearchApplication $ssa

 

Clone the current Search topology
$clone=New-SPEnterpriseSearchTopology -Clone -SearchApplication $ssa -SearchTopology $current

 

Modify the cloned Search topology
This will add a second index component with a new index location.
New-SPEnterpriseSearchIndexComponent -SearchTopology $clone -IndexPartition 0 -SearchServiceInstance $instance -RootDirectory “D:\SharePoint\SearchIndex”

 

Activate the cloned Search topology
Set-SPEnterpriseSearchTopology -Identity $clone
Remove the old Search topology
Remove-SPEnterpriseSearchTopology -Identity $current

 

Remove the old index component
$current=Get-SPEnterpriseSearchTopology -SearchApplication $ssa
$clone=New-SPEnterpriseSearchTopology -Clone -SearchApplication $ssa -SearchTopology $current
$comp=Get-SPEnterpriseSearchComponent -SearchTopology $clone | ? {$_.Name -eq “IndexComponent1”}
Remove-SPEnterpriseSearchComponent -Identity $comp -SearchTopology $clone
Set-SPEnterpriseSearchTopology -Identity $clone
Remove-SPEnterpriseSearchTopology -Identity $current

Leave a Reply

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