static void InitializeServices() { // create the storage containers if needed CloudBlobClient blobClient = CloudStorageAccount.Parse($"DefaultEndpointsProtocol=https;AccountName={Config.IMAGE_AZURE_STORAGE_ACCOUNT_NAME};AccountKey={Config.IMAGE_BLOB_STORAGE_ACCOUNT_KEY};EndpointSuffix=core.windows.net").CreateCloudBlobClient(); blobClient.GetContainerReference(Config.IMAGE_BLOB_STORAGE_CONTAINER).CreateIfNotExists(BlobContainerPublicAccessType.Blob); blobClient.GetContainerReference(Config.LIBRARY_BLOB_STORAGE_CONTAINER).CreateIfNotExists(BlobContainerPublicAccessType.Off); var searchHelper = new AzureSearchHelper(Config.AZURE_SEARCH_SERVICE_NAME, Config.AZURE_SEARCH_ADMIN_KEY); var serviceClient = new SearchServiceClient(Config.AZURE_SEARCH_SERVICE_NAME, new SearchCredentials(Config.AZURE_SEARCH_ADMIN_KEY)); var demoBoost = File.ReadAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DemoBoost.json")); // Create the Synonyms Console.WriteLine("Creating Synonym Map"); var json = File.ReadAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "AddSynonyms.json")); searchHelper.Put("synonymmaps/cryptonyms", json, "2016-09-01-Preview"); // create the index if needed Console.WriteLine("Create the index"); json = File.ReadAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "CreateIndex.json")); searchHelper.Put("indexes/" + Config.AZURE_SEARCH_INDEX_NAME, json, "2016-09-01-Preview"); // Update documents with boost scores Console.WriteLine("Boosting Documents"); json = File.ReadAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DemoBoost.json")); searchHelper.Post("indexes/" + Config.AZURE_SEARCH_INDEX_NAME + "/docs/index", json); // test the pipeline and index Console.WriteLine("Sending a test image through the pipeline"); using (var file = File.OpenRead(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "photo.jpg"))) { EnrichFunction.Run(file, "photo_jpg", log).Wait(); } Console.WriteLine("Querying the test image"); var indexClient = serviceClient.Indexes.GetClient(Config.AZURE_SEARCH_INDEX_NAME); var results = indexClient.Documents.Search("oswald", new SearchParameters() { Facets = new[] { "entities" }, HighlightFields = new[] { "text" }, }); // TODO: Add some additional validations for fields if (results.Results.Count > 0) { Console.WriteLine("Item found in index"); } else { Console.WriteLine("Item missing from index"); } }