Skip to content

Instantly share code, notes, and snippets.

@cmatskas
Last active February 7, 2018 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmatskas/5eb6c277712e8f90a4ceb91e9405e121 to your computer and use it in GitHub Desktop.
Save cmatskas/5eb6c277712e8f90a4ceb91e9405e121 to your computer and use it in GitHub Desktop.
Run Search Indexer manually
using System;
using System.Configuration;
using System.Net.Http;
public static async Task Run(TimerInfo myTimer, TraceWriter log)
{
SearchServiceClient searchService = new SearchServiceClient(
searchServiceName: ConfigurationManager.AppSettings["SearchServiceName"];,
credentials: new SearchCredentials(ConfigurationManager.AppSettings["SearchServiceAdminApiKey"]));
var indexerName = ConfigurationManager.AppSettings["indexerName"];
var exists = await searchService.Indexers.ExistsAsync(indexerName);
if (exists)
{
await searchService.Indexers.RunAsync(indexerName);
log.Info($"Indexer {indexerName} was executed at: {DateTime.Now}");
}
// call the next function to retrieve the deleted blobs
using (var client = new HttpClient())
{
await client.GetAsync("<AzureFunctionUri");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment