7

I have a sharepoint 2013 server with search on two separate servers. I want to set the IndexLocation from c:\Program Files \Microsoft Office Servers\15.0\Data\Office Server\APplications to E:\SearchIndex. I have tried several scripts on the web and nothing worked.

Does anyone have a step by step (using SharePoint PowerShell) to do this including removing the c: location?

Thank you.

2
  • what error /issue you are facing? if you share details about the error then we will guide you in better way. blog.sharepointgeek.nl/post/2013/09/18/…
    – Waqas Sarwar MVP
    May 13, 2015 at 2:49
  • Yes I spent about 5 hours with this yester and still have errors. Today when I got to the "clone topology" I error out.
    – TKK
    May 13, 2015 at 21:25

3 Answers 3

11

It is possible to change the search index location to a dedicated volume after the installation using PowerShell.

You can find a great artivle about it here, the following is an abstract from that post:

Managing the search topology in SharePoint 2013 can be done only via PowerShell.

Here is an article about the procedure:

Refer here

Changing the search index location can be done by following the next steps:

  • Get the current search topology
  • Clone the current search topology
  • Modify the cloned Search topology(add a new index component with new search index location)
  • Activate the cloned search topology
  • Remove the old search topology
  • remove old index component(This means clone, modify, activate search topology and remove the old search topology)

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 "E:\NewIndexLocation"

Activate the cloned Search topology

Set-SPEnterpriseSearchTopology -Identity $clone

Remove the old Search topology

Remove-SPEnterpriseSearchTopology -Identity $current

The next step, remove the old index component, should be done when the new index component is ready. This can be checked from Central Admin on the Search Administration page, view the status of the search topology or use PowerShell Get-SPEnterpriseSearchStatus. The new index component must be Active.

Remove the old index component

This must be done by get, clone, modify, activate the new search topology and remove the old search topology.

$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
4

SharePoint 2013 places the Search index in the C: by default. There are many reasons why you would want to move the index to a different places.

This script will take three parameters, the Search Service Name, the Server Name and Index Location. There is an example on the bottom of the script.

Move-SPEnterpriseSearchIndex -SearchServiceName "Search Service Application" -Server "SP2013-WFE" -IndexLocation "C:\Index"

Here is complete script, you can also get it from here:

    #----------------------------------------------------------------------------- 
# Name:               Move-SPEnterpriseSearchIndex.ps1  
# Description:         This script will move the SharePoint 2013 Search Index 
#                     
# Usage:            Run the function with the 3 required Parameters 
# By:                 Ivan Josipovic, Softlanding.ca  
#----------------------------------------------------------------------------- 
function Move-SPEnterpriseSearchIndex($SearchServiceName,$Server,$IndexLocation){ 
    Add-PSSnapin Microsoft.SharePoint.PowerShell -ea 0; 
    #Gets the Search Service Application 
    $SSA = Get-SPServiceApplication -Name $SearchServiceName; 
    if (!$?){throw "Cant find a Search Service Application: `"$SearchServiceName`"";} 
    #Gets the Search Service Instance on the Specified Server 
    $Instance = Get-SPEnterpriseSearchServiceInstance -Identity $Server; 
    if (!$?){throw "Cant find a Search Service Instance on Server: `"$Server`"";} 
    #Gets the current Search Topology 
    $Current = Get-SPEnterpriseSearchTopology -SearchApplication $SSA -Active; 
    if (!$?){throw "There is no Active Topology, you can try removing the `"-Active`" from the line above in the script";} 
    #Creates a Copy of the current Search Topology 
    $Clone = New-SPEnterpriseSearchTopology -Clone -SearchApplication $SSA -SearchTopology $Current; 
    #Adds a new Index Component with the new Index Location 
    New-SPEnterpriseSearchIndexComponent -SearchTopology $Clone -IndexPartition 0 -SearchServiceInstance $Instance -RootDirectory $IndexLocation | Out-Null; 
    if (!$?){throw "Make sure that Index Location `"$IndexLocation`" exists on Server: `"$Server`"";} 
    #Sets our new Search Topology as Active 
    Set-SPEnterpriseSearchTopology -Identity $Clone; 
    #Removes the old Search Topology 
    Remove-SPEnterpriseSearchTopology -Identity $Current -Confirm:$false; 
    #Now we need to remove the extra Index Component 
    #Gets the Search Topology 
    $Current = Get-SPEnterpriseSearchTopology -SearchApplication $SSA -Active; 
    #Creates a copy of the current Search Topology 
    $Clone=New-SPEnterpriseSearchTopology -Clone -SearchApplication $SSA -SearchTopology $Current; 
    #Removes the old Index Component from the Search Topology 
    Get-SPEnterpriseSearchComponent -SearchTopology $Clone | ? {($_.GetType().Name -eq "IndexComponent") -and ($_.ServerName -eq $($Instance.Server.Address)) -and ($_.RootDirectory -ne $IndexLocation)} | Remove-SPEnterpriseSearchComponent -SearchTopology $Clone -Confirm:$false; 
    #Sets our new Search Topology as Active 
    Set-SPEnterpriseSearchTopology -Identity $Clone; 
    #Removes the old Search Topology 
    Remove-SPEnterpriseSearchTopology -Identity $Current -Confirm:$False; 
    Write-Host "The Index has been moved to $IndexLocation on $Server" 
    Write-Host "This will not remove the data from the old index location. You will have to do that manually :)" 
} 
1
  • A handy script that also works in SharePoint 2016. The only thing I would add is to check if the target index location is empty (running the script on non-empty index location throws an exception) or not and maybe automate the moving of the data from the old index to new location.
    – H A
    Jan 24, 2017 at 8:44
0

Try the following to move the Index location. This works for SP2010 , not sure about 2013 though.

On the SharePoint Central Administration Web page, click General Application Settings and in the Search section, click Farm-wide Search Dashboard.

In the Search Service Application section, select the search application that generated the event, and then click Modify Topology.

On the Topology for Search Service Application page, click Query Component, and then click Edit Properties.

In the Location of Index box, specify the new storage path for the query component index. Click OK, and then click Apply Topology Changes.

Source : https://technet.microsoft.com/en-us/library/ee513130(v=office.14).aspx

2
  • 2
    This is not available for 2013 Oct 11, 2016 at 13:20
  • 2
    You cannot modify the 2013 search topology from within Central Admin. It must be done via PowerShell as demonstrated by the other two answers.
    – Greg W
    Oct 11, 2016 at 13:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.