public async Task Index() { await using SearchResources resources = await SearchResources.CreateWithEmptyHotelsIndexAsync(this); SearchIndexClient client = resources.GetQueryClient(); try { #region Snippet:Azure_Search_Tests_Samples_Readme_Index IndexDocumentsBatch <Hotel> batch = IndexDocumentsBatch.Create( IndexDocumentsAction.Upload(new Hotel { Id = "783", Name = "Upload Inn" }), IndexDocumentsAction.Merge(new Hotel { Id = "12", Name = "Renovated Ranch" })); IndexDocumentsOptions options = new IndexDocumentsOptions { ThrowOnAnyError = true }; client.IndexDocuments(batch, options); #endregion Snippet:Azure_Search_Tests_Samples_Readme_Index } catch (RequestFailedException) { // Ignore the non-existent merge failure } }