public async Task CreateIndex() { await using SearchResources resources = SearchResources.CreateWithNoIndexes(this); Environment.SetEnvironmentVariable("SEARCH_ENDPOINT", resources.Endpoint.ToString()); Environment.SetEnvironmentVariable("SEARCH_API_KEY", resources.PrimaryApiKey); #region Snippet:Azure_Search_Tests_Samples_Readme_CreateIndex Uri endpoint = new Uri(Environment.GetEnvironmentVariable("SEARCH_ENDPOINT")); string key = Environment.GetEnvironmentVariable("SEARCH_API_KEY"); // Create a service client AzureKeyCredential credential = new AzureKeyCredential(key); SearchIndexClient client = new SearchIndexClient(endpoint, credential); /*@@*/ client = resources.GetIndexClient(); // Create the index using FieldBuilder. #region Snippet:Azure_Search_Tests_Samples_Readme_CreateIndex_New_SearchIndex //@@SearchIndex index = new SearchIndex("hotels") /*@@*/ SearchIndex index = new SearchIndex(Recording.Random.GetName()) { Fields = new FieldBuilder().Build(typeof(Hotel)), Suggesters = { // Suggest query terms from the hotelName field. new SearchSuggester("sg", "hotelName") } }; #endregion Snippet:Azure_Search_Tests_Samples_Readme_CreateIndex_New_SearchIndex client.CreateIndex(index); #endregion Snippet:Azure_Search_Tests_Samples_Readme_CreateIndex resources.IndexName = index.Name; }
private static SearchIndex CreateDemoIndex(SearchIndexClient indexClient) { FieldBuilder builder = new FieldBuilder(); var index = new SearchIndex("demoindex") { Fields = builder.Build(typeof(DemoIndex)) }; try { indexClient.GetIndex(index.Name); indexClient.DeleteIndex(index.Name); } catch (RequestFailedException ex) when(ex.Status == 404) { //if the specified index not exist, 404 will be thrown. } try { indexClient.CreateIndex(index); } catch (RequestFailedException ex) { Console.WriteLine("Failed to create the index\n Exception message: {0}\n", ex.Message); ExitProgram("Cannot continue without an index"); } return(index); }
private static void CreateIndex() { var credential = new AzureKeyCredential(adminKey); var client = new SearchIndexClient(endpoint, credential); var fields = new List <SearchField> { new SearchField("Id", SearchFieldDataType.String) { IsSearchable = false, IsKey = true }, new SearchField("Name", SearchFieldDataType.String) { IsSearchable = true, IsKey = false } }; client.CreateIndex(new SearchIndex(indexName, fields)); }
public async Task CreateIndex() { await using SearchResources resources = SearchResources.CreateWithNoIndexes(this); Environment.SetEnvironmentVariable("SEARCH_ENDPOINT", resources.Endpoint.ToString()); Environment.SetEnvironmentVariable("SEARCH_API_KEY", resources.PrimaryApiKey); #region Snippet:Azure_Search_Tests_Samples_Readme_CreateIndex Uri endpoint = new Uri(Environment.GetEnvironmentVariable("SEARCH_ENDPOINT")); string key = Environment.GetEnvironmentVariable("SEARCH_API_KEY"); // Create a service client AzureKeyCredential credential = new AzureKeyCredential(key); SearchIndexClient client = new SearchIndexClient(endpoint, credential); /*@@*/ client = resources.GetIndexClient(); // Create the index //@@SearchIndex index = new SearchIndex("hotels") /*@@*/ SearchIndex index = new SearchIndex(Recording.Random.GetName()) { Fields = { new SimpleField("hotelId", SearchFieldDataType.String) { IsKey = true, IsFilterable= true, IsSortable = true }, new SearchableField("hotelName") { IsFilterable = true, IsSortable = true }, new SearchableField("description") { AnalyzerName = LexicalAnalyzerName.EnLucene }, new SearchableField("tags", collection: true) { IsFilterable = true, IsFacetable = true }, new ComplexField("address") { Fields = { new SearchableField("streetAddress"), new SearchableField("city") { IsFilterable = true, IsSortable = true, IsFacetable = true }, new SearchableField("stateProvince") { IsFilterable = true, IsSortable = true, IsFacetable = true }, new SearchableField("country") { IsFilterable = true, IsSortable = true, IsFacetable = true }, new SearchableField("postalCode") { IsFilterable = true, IsSortable = true, IsFacetable = true } } } }, Suggesters = { // Suggest query terms from both the hotelName and description fields. new SearchSuggester("sg", "hotelName", "description") } }; client.CreateIndex(index); #endregion Snippet:Azure_Search_Tests_Samples_Readme_CreateIndex }
public async Task CreateManualIndex() { await using SearchResources resources = SearchResources.CreateWithNoIndexes(this); SearchIndexClient client = resources.GetIndexClient(); #region Snippet:Azure_Search_Tests_Samples_Readme_CreateManualIndex // Create the index using field definitions. #region Snippet:Azure_Search_Tests_Samples_Readme_CreateManualIndex_New_SearchIndex //@@SearchIndex index = new SearchIndex("hotels") /*@@*/ SearchIndex index = new SearchIndex(Recording.Random.GetName()) { Fields = { new SimpleField("hotelId", SearchFieldDataType.String) { IsKey = true, IsFilterable= true, IsSortable = true }, new SearchableField("hotelName") { IsFilterable = true, IsSortable = true }, new SearchableField("description") { AnalyzerName = LexicalAnalyzerName.EnLucene }, new SearchableField("tags", collection: true) { IsFilterable = true, IsFacetable = true }, new ComplexField("address") { Fields = { new SearchableField("streetAddress"), new SearchableField("city") { IsFilterable = true, IsSortable = true, IsFacetable = true }, new SearchableField("stateProvince") { IsFilterable = true, IsSortable = true, IsFacetable = true }, new SearchableField("country") { IsFilterable = true, IsSortable = true, IsFacetable = true }, new SearchableField("postalCode") { IsFilterable = true, IsSortable = true, IsFacetable = true } } } }, Suggesters = { // Suggest query terms from the hotelName field. new SearchSuggester("sg", "hotelName") } }; #endregion Snippet:Azure_Search_Tests_Samples_Readme_CreateManualIndex_New_SearchIndex client.CreateIndex(index); #endregion Snippet:Azure_Search_Tests_Samples_Readme_CreateManualIndex resources.IndexName = index.Name; }
static void Main(string[] args) { string serviceName = "lynx-searchengine-jsancho"; string indexName = "hotels-quickstart-v11"; string apiKey = "6C88A8613367F73135756A4CCFE1C24C"; // Create a SearchIndexClient to send create/delete index commands Uri serviceEndpoint = new Uri($"https://{serviceName}.search.windows.net/"); AzureKeyCredential credential = new AzureKeyCredential(apiKey); SearchIndexClient idxclient = new SearchIndexClient(serviceEndpoint, credential); // Create a SearchClient to load and query documents SearchClient srchclient = new SearchClient(serviceEndpoint, indexName, credential); // Delete index if it exists Console.WriteLine("{0}", "Deleting index...\n"); DeleteIndexIfExists(indexName, idxclient); var searchClientOptions = new SearchClientOptions { Serializer = new JsonObjectSerializer( new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }) }; var builder = new FieldBuilder { Serializer = searchClientOptions.Serializer }; var index = new SearchIndex(indexName) { Fields = builder.Build(typeof(Hotel)) }; Console.WriteLine("{0}", "Creating index...\n"); idxclient.CreateIndex(index); // Load documents (using a subset of fields for brevity) IndexDocumentsBatch <Hotel> batch = IndexDocumentsBatch.Create( IndexDocumentsAction.Upload(new Hotel { Id = "78", Name = "Upload Inn", Category = "hotel", Rate = 279, Updated = new DateTime(2018, 3, 1, 7, 0, 0) }), IndexDocumentsAction.Upload(new Hotel { Id = "54", Name = "Breakpoint by the Sea", Category = "motel", Rate = 162, Updated = new DateTime(2015, 9, 12, 7, 0, 0) }), IndexDocumentsAction.Upload(new Hotel { Id = "39", Name = "Debug Motel", Category = "motel", Rate = 159, Updated = new DateTime(2016, 11, 11, 7, 0, 0) }), IndexDocumentsAction.Upload(new Hotel { Id = "48", Name = "NuGet Hotel", Category = "hotel", Rate = 238, Updated = new DateTime(2016, 5, 30, 7, 0, 0) }), IndexDocumentsAction.Upload(new Hotel { Id = "12", Name = "Renovated Ranch", Category = "motel", Rate = 149, Updated = new DateTime(2020, 1, 24, 7, 0, 0) })); IndexDocumentsOptions idxoptions = new IndexDocumentsOptions { ThrowOnAnyError = true }; Console.WriteLine("{0}", "Loading index...\n"); srchclient.IndexDocuments(batch, idxoptions); // Wait 2 secondsfor indexing to complete before starting queries (for demo and console-app purposes only) Console.WriteLine("Waiting for indexing...\n"); System.Threading.Thread.Sleep(2000); // Call the RunQueries method to invoke a series of queries Console.WriteLine("Starting queries...\n"); RunQueries(srchclient); // End the program Console.WriteLine("{0}", "Complete. Press any key to end this program...\n"); Console.ReadKey(); }
static async Task Main(string[] args) { IConfigurationBuilder builder = new ConfigurationBuilder().AddJsonFile("appsettings.json"); IConfigurationRoot configuration = builder.Build(); string searchServiceName = configuration["SearchServiceName"]; string adminApiKey = configuration["SearchServiceAdminApiKey"]; Uri serviceEndpoint = new Uri($"https://{searchServiceName}.search.windows.net/"); AzureKeyCredential credential = new AzureKeyCredential(adminApiKey); SearchIndexClient searchIndexClient = new SearchIndexClient(serviceEndpoint, credential); SearchClient searchServiceClient = new SearchClient(serviceEndpoint, "newknadocsindex", credential); if (configuration["SearchServiceName"] == "Put your search service name here") { Console.Error.WriteLine("Specify SearchServiceName in appsettings.json"); Environment.Exit(-1); } if (configuration["SearchServiceAdminApiKey"] == "Put your primary or secondary API key here") { Console.Error.WriteLine("Specify SearchServiceAdminApiKey in appsettings.json"); Environment.Exit(-1); } if (configuration["AzureStoreageConnectionString"] == "Put your Storage ConnnectionString here") { Console.Error.WriteLine("Specify SearchServiceAdminApiKey in appsettings.json"); Environment.Exit(-1); } Console.WriteLine("Press c to create datasource. Press ci to create an index. Press l to list the datasources. Press S to seary the SearchService. Press q to query QnA."); var res = Console.ReadLine().ToString(); if (res == "c") { Console.WriteLine("Use Y for API or N for SDK."); var useAPI = Console.ReadLine(); if (useAPI == "Y") { var dsresponseapi = await CreateDataSourceAPI(configuration); } else if (useAPI == "N") { var dsresponse = await CreateDataSource(searchServiceClient, configuration); } } else if (res == "ci") { Console.WriteLine("Create Index! What name should we use?"); var indexName = Console.ReadLine(); var index = CreateIndex(indexName); searchIndexClient.CreateIndex(index); } else if (res == "l") { Console.WriteLine("Get Data Source List!"); var dsresponse = await ListDataSource(searchServiceClient, configuration); } else if (res == "s") { Console.WriteLine("Search SearchService!"); RunQueries(searchServiceClient); } else if (res == "q") { Console.WriteLine("Query QnA!"); var resp = await QueryQnA(); } }
static void Main(string[] args) { //Setting up db context var optionsBuilder = new DbContextOptionsBuilder <BankAppDataContext>(); var context = new BankAppDataContext(optionsBuilder.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")).Options); string serviceName = Environment.GetEnvironmentVariable("SearchService"); string indexName = "customersearch"; string apiKey = Environment.GetEnvironmentVariable("SearchKey"); // Create a SearchIndexClient to send create/delete index commands Uri serviceEndpoint = new Uri($"https://{serviceName}.search.windows.net/"); AzureKeyCredential credential = new AzureKeyCredential(apiKey); SearchIndexClient idxclient = new SearchIndexClient(serviceEndpoint, credential); // Create a SearchClient to load and query documents SearchClient qryclient = new SearchClient(serviceEndpoint, indexName, credential); // Define an index schema using SearchIndex // Create the index using SearchIndexClient SearchIndex index = new SearchIndex(indexName) { Fields = { new SimpleField("customerId", SearchFieldDataType.String) { IsKey = true, IsSortable= true }, new SearchableField("givenName") { IsSortable = true, IsHidden = true }, new SearchableField("surname") { IsSortable = true, IsHidden = true }, new SearchableField("city") { IsSortable = true, IsHidden = true }, new SimpleField("streetAddress", SearchFieldDataType.String) { IsSortable = true, IsHidden = true }, new SimpleField("nationalId", SearchFieldDataType.String) { IsSortable = true, IsHidden = true } } }; idxclient.CreateIndex(index); //Fyller index med data var actions = new List <IndexDocumentsAction <CustomerIndex> >(); foreach (var customers in context.Customers) { actions.Add(IndexDocumentsAction.Upload(new CustomerIndex { CustomerId = customers.CustomerId.ToString(), City = customers.City, Givenname = customers.Givenname, NationalId = customers.NationalId, Streetaddress = customers.Streetaddress, Surname = customers.Surname })); } ; IndexDocumentsBatch <CustomerIndex> batch = IndexDocumentsBatch.Create(actions.ToArray()); IndexDocumentsOptions idxoptions = new IndexDocumentsOptions { ThrowOnAnyError = true }; qryclient.IndexDocuments(batch, idxoptions); }
public async Task CreateIndex() { await using SearchResources resources = SearchResources.CreateWithNoIndexes(this); Environment.SetEnvironmentVariable("SEARCH_ENDPOINT", resources.Endpoint.ToString()); Environment.SetEnvironmentVariable("SEARCH_API_KEY", resources.PrimaryApiKey); #region Snippet:Azure_Search_Tests_Sample2_FieldBuilderIgnore_CreateIndex Uri endpoint = new Uri(Environment.GetEnvironmentVariable("SEARCH_ENDPOINT")); string key = Environment.GetEnvironmentVariable("SEARCH_API_KEY"); // Define client options to use camelCase when serializing property names. SearchClientOptions options = new SearchClientOptions(ServiceVersion) { Serializer = new JsonObjectSerializer( new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }) }; // Create a service client. AzureKeyCredential credential = new AzureKeyCredential(key); SearchIndexClient indexClient = new SearchIndexClient(endpoint, credential, options); #if !SNIPPET indexClient = resources.GetIndexClient(options); #endif // Create the FieldBuilder using the same serializer. FieldBuilder fieldBuilder = new FieldBuilder { Serializer = options.Serializer }; // Create the index using FieldBuilder. #if SNIPPET SearchIndex index = new SearchIndex("movies") #else SearchIndex index = new SearchIndex(Recording.Random.GetName()) #endif { Fields = fieldBuilder.Build(typeof(Movie)), Suggesters = { // Suggest query terms from the "name" field. new SearchSuggester("n", "name") } }; // Define the "genre" field as a string. SearchableField genreField = new SearchableField("genre") { AnalyzerName = LexicalAnalyzerName.Values.EnLucene, IsFacetable = true, IsFilterable = true }; index.Fields.Add(genreField); // Create the index. indexClient.CreateIndex(index); #endregion Snippet:Azure_Search_Tests_Sample2_FieldBuilderIgnore_CreateIndex // Make sure the index is removed. resources.IndexName = index.Name; #region Snippet:Azure_Search_Tests_Sample2_FieldBuilderIgnore_UploadDocument Movie movie = new Movie { Id = Guid.NewGuid().ToString("n"), Name = "The Lord of the Rings: The Return of the King", Genre = MovieGenre.Fantasy, Year = 2003, Rating = 9.1 }; // Add a movie to the index. SearchClient searchClient = indexClient.GetSearchClient(index.Name); searchClient.UploadDocuments(new[] { movie }); #endregion Snippet:Azure_Search_Tests_Sample2_FieldBuilderIgnore_UploadDocument }
static void Main(string[] args) { string serviceName = "<YOUR-SEARCH-SERVICE-NAME>"; string indexName = "hotels-quickstart-v11"; string apiKey = "<YOUR-ADMIN-API-KEY>"; // Create a SearchIndexClient to send create/delete index commands Uri serviceEndpoint = new Uri($"https://{serviceName}.search.windows.net/"); AzureKeyCredential credential = new AzureKeyCredential(apiKey); SearchIndexClient idxclient = new SearchIndexClient(serviceEndpoint, credential); // Create a SearchClient to load and query documents SearchClient qryclient = new SearchClient(serviceEndpoint, indexName, credential); // Delete index if it exists Console.WriteLine("{0}", "Deleting index...\n"); DeleteIndexIfExists(indexName, idxclient); // Define an index schema and create the index SearchIndex index = new SearchIndex(indexName) { Fields = { new SimpleField("hotelId", SearchFieldDataType.String) { IsKey = true, IsFilterable= true, IsSortable = true }, new SearchableField("hotelName") { IsFilterable = true, IsSortable = true }, new SearchableField("hotelCategory") { IsFilterable = true, IsSortable = true }, new SimpleField("baseRate", SearchFieldDataType.Int32) { IsFilterable = true, IsSortable = true }, new SimpleField("lastRenovationDate", SearchFieldDataType.DateTimeOffset) { IsFilterable = true, IsSortable = true } } }; Console.WriteLine("{0}", "Creating index...\n"); idxclient.CreateIndex(index); // Load documents (using a subset of fields for brevity) IndexDocumentsBatch <Hotel> batch = IndexDocumentsBatch.Create( IndexDocumentsAction.Upload(new Hotel { Id = "78", Name = "Upload Inn", Category = "hotel", Rate = 279, Updated = new DateTime(2018, 3, 1, 7, 0, 0) }), IndexDocumentsAction.Upload(new Hotel { Id = "54", Name = "Breakpoint by the Sea", Category = "motel", Rate = 162, Updated = new DateTime(2015, 9, 12, 7, 0, 0) }), IndexDocumentsAction.Upload(new Hotel { Id = "39", Name = "Debug Motel", Category = "motel", Rate = 159, Updated = new DateTime(2016, 11, 11, 7, 0, 0) }), IndexDocumentsAction.Upload(new Hotel { Id = "48", Name = "NuGet Hotel", Category = "hotel", Rate = 238, Updated = new DateTime(2016, 5, 30, 7, 0, 0) }), IndexDocumentsAction.Upload(new Hotel { Id = "12", Name = "Renovated Ranch", Category = "motel", Rate = 149, Updated = new DateTime(2020, 1, 24, 7, 0, 0) })); IndexDocumentsOptions idxoptions = new IndexDocumentsOptions { ThrowOnAnyError = true }; Console.WriteLine("{0}", "Loading index...\n"); qryclient.IndexDocuments(batch, idxoptions); // Wait 2 secondsfor indexing to complete before starting queries (for demo and console-app purposes only) Console.WriteLine("Waiting for indexing...\n"); System.Threading.Thread.Sleep(2000); // Call the RunQueries method to invoke a series of queries Console.WriteLine("Starting queries...\n"); RunQueries(qryclient); // End the program Console.WriteLine("{0}", "Complete. Press any key to end this program...\n"); Console.ReadKey(); }
// This sample shows how ETags work by performing conditional updates and deletes // on an Azure Search index. static async Task Main(string[] args) { IConfigurationBuilder builder = new ConfigurationBuilder().AddJsonFile("appsettings.json"); IConfigurationRoot configuration = builder.Build(); SearchIndexClient indexClient = CreateSearchIndexClient(configuration); Console.WriteLine("Deleting index...\n"); DeleteTestIndexIfExists(indexClient); // Every top-level resource in Azure Search has an associated ETag that keeps track of which version // of the resource you're working on. When you first create a resource such as an index, its ETag is // empty. SearchIndex index = DefineTestIndex(); Console.WriteLine( $"Test searchIndex hasn't been created yet, so its ETag should be blank. ETag: '{index.ETag}'"); // Once the resource exists in Azure Search, its ETag will be populated. Make sure to use the object // returned by the SearchIndexClient! Otherwise, you will still have the old object with the // blank ETag. //Console.WriteLine("Creating index...\n"); index = indexClient.CreateIndex(index); Console.WriteLine($"Test index created; Its ETag should be populated. ETag: '{index.ETag}'"); // ETags let you do some useful things you couldn't do otherwise. For example, by using an If-Match // condition, we can update an index using CreateOrUpdateIndexAsync() and be guaranteed that the update will only // succeed if the index already exists. index.Fields.Add(new SearchField("name", SearchFieldDataType.String) { AnalyzerName = LexicalAnalyzerName.EnMicrosoft }); index = indexClient.CreateOrUpdateIndex(index); index = await indexClient.CreateOrUpdateIndexAsync(index); Console.WriteLine( $"Test searchIndex updated; Its ETag should have changed since it was created. ETag: '{index.ETag}'"); // More importantly, ETags protect you from concurrent updates to the same resource. If another // client tries to update the resource, it will fail as long as all clients are using the right // access conditions. SearchIndex indexForClientUpdate = index; SearchIndex indexForClientUpdateFailed = indexClient.GetIndex("test"); Console.WriteLine("Simulating concurrent update. To start, both clients see the same ETag."); Console.WriteLine($"ClientUpdate ETag: '{indexForClientUpdate.ETag}' ClientUpdateFailed ETag: '{indexForClientUpdateFailed.ETag}'"); // indexForClientUpdate successfully updates the index. indexForClientUpdate.Fields.Add(new SearchField("a", SearchFieldDataType.Int32)); indexForClientUpdate = indexClient.CreateOrUpdateIndex(indexForClientUpdate); Console.WriteLine($"Test index updated by ClientUpdate; ETag: '{indexForClientUpdate.ETag}'"); // indexForClientUpdateFailed tries to update the index, but fails, thanks to the ETag check. try { indexForClientUpdateFailed.Fields.Add(new SearchField("b", SearchFieldDataType.Boolean)); indexClient.CreateOrUpdateIndex(indexForClientUpdateFailed); Console.WriteLine("Whoops; This shouldn't happen"); Environment.Exit(1); } catch (RequestFailedException e) when(e.Status == 400) { Console.WriteLine("ClientUpdateFailed failed to update the index, as expected."); } // You can also use access conditions with Delete operations. For example, you can implement an // atomic version of the DeleteTestIndexIfExists method from this sample like this: Console.WriteLine("Deleting index...\n"); indexClient.DeleteIndex("test"); // This is slightly better than using the Exists method since it makes only one round trip to // Azure Search instead of potentially two. It also avoids an extra Delete request in cases where // the resource is deleted concurrently, but this doesn't matter much since resource deletion in // Azure Search is idempotent. // And we're done! Bye! Console.WriteLine("Complete. Press any key to end application...\n"); Console.ReadKey(); }
// Create the index private static void CreateIndex(string indexName, SearchIndexClient idxclient) { // Define an index schema and create the index Console.WriteLine("{0}", "Creating index...\n"); var index = new SearchIndex(indexName) { Fields = { new SimpleField("id", SearchFieldDataType.String) { IsKey = true, IsFilterable= true }, new SimpleField("magId", SearchFieldDataType.String) { IsFilterable = true }, new SearchableField("entities", true) { IsFilterable = true, IsFacetable = true, AnalyzerName = "en.microsoft" }, new SearchableField("fieldsOfStudy", true) { IsFilterable = true, IsFacetable = true }, new SimpleField("journalVolume", SearchFieldDataType.String) { IsFilterable = false, IsFacetable = false }, new SimpleField("journalPages", SearchFieldDataType.String) { IsFilterable = false, IsFacetable = false }, new SimpleField("pmid", SearchFieldDataType.String) { IsFilterable = false, IsFacetable = false }, new SimpleField("year", SearchFieldDataType.Int32) { IsFilterable = true, IsSortable = true, IsFacetable = true }, new SimpleField("s2Url", SearchFieldDataType.String) { IsFilterable = false, IsFacetable = false }, new SimpleField("s2PdfUrl", SearchFieldDataType.String) { IsFilterable = false, IsFacetable = false }, new SimpleField("journs2PdfUrlalPages", SearchFieldDataType.String) { IsFilterable = false, IsFacetable = false }, new SearchableField("journalName") { IsFilterable = true, IsFacetable = true, AnalyzerName = "en.microsoft" }, new SearchableField("paperAbstract") { IsFilterable = false, IsFacetable = false, AnalyzerName = "en.microsoft" }, new SearchableField("title") { IsFilterable = false, IsFacetable = false, AnalyzerName = "en.microsoft" }, new SimpleField("doi", SearchFieldDataType.String) { IsFilterable = false, IsFacetable = false }, new SimpleField("doiUrl", SearchFieldDataType.String) { IsFilterable = false, IsFacetable = false }, new SearchableField("venue") { IsFilterable = true, IsFacetable = true, AnalyzerName = "en.microsoft" }, new SearchableField("outCitations", true) { IsFilterable = true, IsFacetable = true }, new SearchableField("inCitations", true) { IsFilterable = false, IsFacetable = false }, new SearchableField("pdfUrls", true) { IsFilterable = false, IsFacetable = false }, new SearchableField("sources", true) { IsFilterable = true, IsFacetable = true }, new ComplexField("authors", collection: true) { Fields = { new SearchableField("name") { IsFilterable = true, IsFacetable = true, AnalyzerName = "en.microsoft" }, new SearchableField("ids", true) { IsFilterable = true, IsFacetable = true } } } } }; idxclient.CreateIndex(index); }