Enable Continuous Crawl in SharePoint Server using PowerShell
The continuous crawl was introduced in SharePoint 2016 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 the “Enable Continuous Crawls” option under the Crawl Schedules section.
- 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 a given content source name, let’s enable continuous crawl for all SharePoint content sources 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?