Skip to content

I want to rebuild the search index in a batch process

Answer

Please execute the API for "Rebuild Search Indexes".


Overview

"Search index" may not be created for data registered by batch processing, etc. In that case, you need to execute "Rebuild Search Index" from the screen, but you can rebuild the index by executing the "Rebuild Search Indexes" API within the batch processing.

Prerequisites

  1. "Enabled" in the parameter "BackgroundTask.json" must be set to true.

Operation

  1. Execute the "Rebuild Search Indexes" API within the batch processing.

Script Example

Execute the search index rebuild API in PowerShell.

PowerShell

$params = @{
    "ApiVersion": 1.1;
    "ApiKey": "xxxxx...";
}
$response = Invoke-RestMethod -Uri http://{server name}/api/BackgroundTasks/{site ID}/RebuildSearchIndexes -Method POST -Body ($params|ConvertTo-Json) -ContentType "application/json";

※Edit the {server name} and {site ID} parts as appropriate to suit your environment.