using (var serviceClient = new SearchServiceClient(indexinfo.IndexSearchServiceName, new SearchCredentials(indexinfo.IndexAdminKey)))
{
var azureIndex = serviceClient.Indexes.GetClient(NamingHelper.GetValidIndexName(indexinfo.IndexName));
var actions = productPages.Select(x =>
{
var price = AsyncUtil.RunSync(() => _priceCalculator.Calculate(x.NodeSKUID, qty: 1));
return IndexAction.Merge(new Document
{
{ "sys_id", $"{x.NodeID}-{x.DocumentID}" },
{ "price", price.PriceExVat }
});
}).ToArray();
var result = azureIndex.Documents.Index(new IndexBatch<Document> { Actions = actions });
}