Beispiel #1
0
 private static void CleanupResources(SearchIndexClient indexClient)
 {
     try
     {
         if (indexClient.GetIndex("hotels") != null)
         {
             indexClient.DeleteIndex("hotels");
         }
         if (indexClient.GetSynonymMapNames().Value.Contains("desc-synonymmap"))
         {
             indexClient.DeleteSynonymMap("desc-synonymmap");
         }
     }
     catch (RequestFailedException e) when(e.Status == 404)
     {
         //if exception occurred and status is "Not Found", this is work as expect
         Console.WriteLine("Failed to find index and this is because it's not there.");
     }
 }