# Update Search Index Job
Maintains search index consistency across document libraries by re-indexing libraries that have item count mismatches.
Configuration class: UpdateSearchIndexJobCfg
Schedule base: RandomEveryDayScheduleCfg (runs once daily at a random time)
# Purpose
SharePoint search index can occasionally become out of sync with actual library contents. This job detects and fixes index inconsistencies by:
- Comparing indexed item counts with actual library item counts
- Triggering re-indexing for libraries with mismatches
- Optionally sending reports of problematic libraries
# Configuration
# Disabled
- Type:
bool? - Default: —
- Required: No
- Description: Disable this job without removing configuration
# AutoIndex
- Type:
bool - Default:
false - Required: No
- Description: Automatically trigger re-indexing for libraries with item count mismatches. If
false, only reports discrepancies.
# SendReport
- Type:
bool - Default:
true - Required: No
- Description: Send email report of libraries needing re-indexing
# Subject
- Type:
string - Default:
"Update search index job" - Required: No
- Description: Email subject line for the report
# Take
- Type:
int - Default:
50 - Required: No
- Description: Page size — number of matters to retrieve per search query
# EndTime
- Type:
TimeSpan - Default:
06:00:00 - Required: No
- Description: Stop processing new batches after this time of day. Active batches are completed even if past this time. Example:
06:00:00means stop starting new work at 6 AM.
# SortBy
- Type:
string - Default:
"ID" - Required: No
- Description: Field name to sort results by when querying libraries. Example:
"Modified"to process recently changed items first.
# CurrentState
- Type:
UpdateSearchIndexJobState - Default: —
- Required: No
- Description: System-managed — stores current job state
# Scheduling Properties
# StartTime
- Type:
TimeSpan? - Default: —
- Description: Earliest time of day to run. Example:
"22:00:00"for 10 PM (useful for overnight processing).
# Example Configuration
{
"Disabled": false,
"AutoIndex": true,
"SendReport": true,
"Subject": "Daily Search Index Report",
"Take": 100,
"EndTime": "06:00:00",
"SortBy": "Modified",
"StartTime": "22:00:00",
"CurrentState": {}
}
# How It Works
- Job runs daily at a random time between
StartTimeand (if configured) midnight - Retrieves document libraries in batches of size
Take - For each library:
- Compares indexed item count with actual library item count
- If mismatch detected and
AutoIndexis true, triggers re-indexing
- Stops starting new batches after
EndTimeto avoid daytime overhead - If
SendReportis enabled, sends email summary of findings - Email recipients come from global email settings
# Report Contents
The email report includes:
- List of libraries with search index mismatches
- Number of indexed vs. actual items for each library
- Whether auto-indexing was triggered
- Any errors encountered during processing
# Notes
- Page size: Increase
Takefor faster processing, decrease to reduce server load per batch - Overnight processing: Combine
StartTime(22:00:00) andEndTime(06:00:00) to run heavy indexing overnight - AutoIndex: Leave
falseto audit discrepancies before automatically re-indexing; turntrueto automatically heal - Sort order:
SortBy: "Modified"prioritizes recently changed libraries (often the source of index lag)
# Related
- Global Settings Configuration — email settings
- Jobs — other background jobs
- Scheduling Jobs — schedule configuration