We're getting tired of creating our Azure Search index manually during development, so I'm writing a console app to do it for us. We already have a data source in Azure which is a database view. That view will feed the index. My question is how do I specify that data source when I create the index? Here's my code so far (not including the Employee class definition):
using Microsoft.Azure.Search;
using Microsoft.Azure.Search.Models;
namespace AdvancedSearchIndexGenerator
{
class Program
{
static void Main()
{
SearchServiceClient client = new SearchServiceClient(Util.AzureSearchServiceName, new SearchCredentials(Util.AzureSearchApiKey));
var definition = new Index()
{
Name = Util.AzureSearchIndexName,
Fields = FieldBuilder.BuildForType<Employee>()
};
client.Indexes.Create(definition);
}
}
}