About Me

My photo
a Dynamic and Energetic guy.....

Monday, October 17, 2016

Move SharePoint 2013 Search Index Location to a other location

When we setup SharePoint Search Service Application using Central Administration, there is no place to set INDEX LOCATION.

With the usage of CRAWLING, the location will be filled with INDEXED files.

If we want to change the location of INDEX folder, we have only 1 options. That is using POWERSHELL.

1) We have to create a new INDEX LOCATION

$IndexLocation = "H:\New_SearchIndex"
New-Item –ItemType Directory –Path $IndexLocation

2) Then we have to get current Search Service Application to a variable

$SearchServiceName = "SearchSer"
$SSA = Get-SPServiceApplication -Name $SearchServiceName; 

3) Then we get the current Search Service Instance to a variable

$Server = "SPDEV1APP"
$Instance = Get-SPEnterpriseSearchServiceInstance -Identity $Server;

4) Then we have to get current serach topology

$Current = Get-SPEnterpriseSearchTopology -SearchApplication $SSA -Active; 

we can current topology using Central Administration. Here we should have all the components in GREEN status.

5) Create a CLONE of current Search Topology

$Clone = New-SPEnterpriseSearchTopology -Clone -SearchApplication $SSA -SearchTopology $Current 

6) Now we SET new INDEX LOCATION

New-SPEnterpriseSearchIndexComponent -SearchTopology $Clone -IndexPartition 0 -SearchServiceInstance $Instance -RootDirectory $IndexLocation 

7) SET new one as ACTIVE

Set-SPEnterpriseSearchTopology -Identity $Clone

If we Type,
Get-SPEnterpriseSearchTopology -Active -SearchApplication $ssa 
It will return 7 components including 2 INDEX COMPONENTS


================================================================

8) Then Gets the Search Topology again,

$SSA = Get-SPEnterpriseSearchServiceApplication
$Current = Get-SPEnterpriseSearchTopology -SearchApplication $SSA -Active

9) Creates a copy of the current Search Topolog again,

$Clone=New-SPEnterpriseSearchTopology -Clone -SearchApplication $SSA -SearchTopology $Current

10) Removes the old Index Component from the Search Topology, THIS IS THE MOST CRITICAL

Get-SPEnterpriseSearchComponent -SearchTopology $Clone | ? {($_.GetType().Name -eq "IndexComponent") -and ($_.ServerName -eq $($Instance.Server.Address)) -and ($_.RootDirectory -ne $IndexLocation)} | Remove-SPEnterpriseSearchComponent -SearchTopology $Clone -Confirm:$false

11) Sets our new Search Topology as Active

Set-SPEnterpriseSearchTopology -Identity $Clone

If we Type again,
Get-SPEnterpriseSearchTopology -Active -SearchApplication $ssa 
It will return only 6 components including only 1 INDEX COMPONENT



It is set to new INDEX LOCATION. Now Do a CRAWL using Central Administration.


My Masters