kwizcom banner advertisement

Enable Continuous Crawl in SharePoint 2013 using PowerShell

Continuous Crawl was introduced in SharePoint 2013 to keep the search results as fresh as possible.
To enable Continuous crawl in SharePoint 2013, follow these steps:
  • Login to SharePoint 2013 Central Administration as a Farm Administrator. In Central Administration, Click on Manage service applications under the Application Management tab
  • Click on your Search service application.
  • In the Search Service Administration page, click on Content Sources link from the left navigation.
  • On the Manage Content Sources page, click the SharePoint content source to which you want to enable continuous crawl.
  • Scroll down and select "Enable Continuous Crawls" option under the Crawl Schedules section.
    sharepoint 2013 enable continuous crawl powershell
  • Click OK to save your changes.
SharePoint 2016: Enable continuous crawl with PowerShell
Here is the PowerShell script to enable continuous crawl in SharePoint 2013 or SharePoint 2016.
#Get Search service application
$SSA =  Get-SPEnterpriseSearchServiceApplication

#Get the content source by name
$ContentSource = Get-SPEnterpriseSearchCrawlContentSource -SearchApplication $SSA -Identity "Local SharePoint sites"

#Check if Continuous Crawls is already enabled
if($ContentSource.EnableContinuousCrawls -eq $true)
{
 Write-host "Continuous Crawl is already Enabled for this content source!" -ForegroundColor Red
}
else
{
        #enable continuous crawl sharepoint 2013
        Set-SPEnterpriseSearchCrawlContentSource -Identity $ContentSource -EnableContinuousCrawls $True
        Write-host "Enabled Continuous Crawl Successfully!" -ForegroundColor Green
}

Enable continuous crawl for all SharePoint 2013 content sources using PowerShell
While the above script enables Continuous crawl for given content source name, Lets enable continuous crawl for all SharePoint content source in SharePoint 2016:
#Get Search service application
$SSA =  Get-SPEnterpriseSearchServiceApplication

#Get all SharePoint content sources
$SPContentSources = Get-SPEnterpriseSearchCrawlContentSource -SearchApplication $SSA | Where-object {$_.Type -eq "SharePoint"} 

foreach ($ContentSource in $SPContentSources) 
{ 
    #Check if Continuous Crawls is already enabled
    if($ContentSource.EnableContinuousCrawls -eq $true)
    {
 Write-host "Continuous Crawl is already Enabled for $($ContentSource.Name)!" -ForegroundColor Yellow
    }
    else
    {
        #enable continuous crawl sharepoint 2013
        Set-SPEnterpriseSearchCrawlContentSource -Identity $ContentSource -EnableContinuousCrawls $True
        Write-host "Enabled Continuous Crawl Successfully for $($ContentSource.Name)" -ForegroundColor Green
    }
}
To disable continuous crawl in SharePoint, refer: How to Disable Continuous Crawl in SharePoint 2013 using PowerShell
Enable Continuous Crawl in SharePoint 2013 using PowerShell Enable Continuous Crawl in SharePoint 2013 using PowerShell Reviewed by Salaudeen Rajack on March 13, 2016 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.