File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed
sdk/search/Azure.Search.Documents Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,28 @@ SearchIndexerDataSourceConnection dataSourceConnection = new SearchIndexerDataSo
131131await indexerClient .CreateDataSourceConnectionAsync (dataSourceConnection );
132132```
133133
134+ #### Create SearchClientOptions
135+
136+ To control specific request behaviors such as timeouts and retries, you can create a client with options.
137+
138+ ``` C# Snippet:Azure_Search_Tests_Samples_CreateIndexerAsync_SearchClientOptions
139+ // Create SearchIndexerClient options
140+ SearchClientOptions options = new SearchClientOptions ()
141+ {
142+ Transport = new HttpClientTransport (new HttpClient ()
143+ {
144+ // Increase timeout for each request to 5 minutes
145+ Timeout = TimeSpan .FromMinutes (5 )
146+ });
147+ };
148+
149+ // Increase retry attempts to 6
150+ options .Retry .MaxRetries = 6 ;
151+
152+ // Create a new SearchIndexerClient with options
153+ indexerClient = new SearchIndexerClient (endpoint , credential , options );
154+ ```
155+
134156### Create a Skillset
135157
136158To provide French translations of descriptions, we'll define a [ translation skill] ( https://docs.microsoft.com/azure/search/cognitive-search-skill-text-translation ) to translate from English.
Original file line number Diff line number Diff line change @@ -276,6 +276,26 @@ public async Task CreateIndexerAsync()
276276 // index is deleted when our SearchResources goes out of scope.
277277 cleanUpTasks . Push ( ( ) => indexerClient . DeleteDataSourceConnectionAsync ( dataSourceConnectionName ) ) ;
278278
279+ #if SNIPPET
280+ #region Snippet:Azure_Search_Tests_Samples_CreateIndexerAsync_SearchClientOptions
281+ // Create SearchIndexerClient options
282+ SearchClientOptions options = new SearchClientOptions ( )
283+ {
284+ Transport = new HttpClientTransport ( new HttpClient ( )
285+ {
286+ // Increase timeout for each request to 5 minutes
287+ Timeout = TimeSpan . FromMinutes ( 5 )
288+ } ) ;
289+ } ;
290+
291+ // Increase retry attempts to 6
292+ options . Retry . MaxRetries = 6 ;
293+
294+ // Create a new SearchIndexerClient with options
295+ indexerClient = new SearchIndexerClient ( endpoint , credential , options ) ;
296+ #endregion Snippet:Azure_Search_Tests_Samples_CreateIndexerAsync_SearchClientOptions
297+ #endif
298+
279299 #region Snippet:Azure_Search_Tests_Samples_CreateIndexerAsync_Skillset
280300 // Translate English descriptions to French.
281301 // See https://docs.microsoft.com/azure/search/cognitive-search-skill-text-translation for details of the Text Translation skill.
You can’t perform that action at this time.
0 commit comments