Delen via


SearchClient Constructors

Definition

Overloads

SearchClient()

Initializes a new instance of the SearchClient class for mocking.

SearchClient(Uri, String, AzureKeyCredential)

Initializes a new instance of the SearchClient class for querying an index and uploading, merging, or deleting documents.

SearchClient(Uri, String, TokenCredential)

Initializes a new instance of the SearchClient class for querying an index and uploading, merging, or deleting documents.

SearchClient(Uri, String, AzureKeyCredential, SearchClientOptions)

Initializes a new instance of the SearchClient class for querying an index and uploading, merging, or deleting documents.

SearchClient(Uri, String, TokenCredential, SearchClientOptions)

Initializes a new instance of the SearchClient class for querying an index and uploading, merging, or deleting documents.

SearchClient()

Source:
SearchClient.cs
Source:
SearchClient.cs

Initializes a new instance of the SearchClient class for mocking.

protected SearchClient ();
Protected Sub New ()

Applies to

SearchClient(Uri, String, AzureKeyCredential)

Source:
SearchClient.cs
Source:
SearchClient.cs

Initializes a new instance of the SearchClient class for querying an index and uploading, merging, or deleting documents.

public SearchClient (Uri endpoint, string indexName, Azure.AzureKeyCredential credential);
new Azure.Search.Documents.SearchClient : Uri * string * Azure.AzureKeyCredential -> Azure.Search.Documents.SearchClient
Public Sub New (endpoint As Uri, indexName As String, credential As AzureKeyCredential)

Parameters

endpoint
Uri

Required. The URI endpoint of the Search Service. This is likely to be similar to "https://{search_service}.search.windows.net". The URI must use HTTPS.

indexName
String

Required. The name of the Search Index.

credential
AzureKeyCredential

Required. The API key credential used to authenticate requests against the search service. You need to use an admin key to modify the documents in a Search Index. See Create and manage api-keys for an Azure Cognitive Search service for more information about API keys in Azure Cognitive Search.

Exceptions

Thrown when the endpoint, indexName, or credential is null.

Thrown when the endpoint is not using HTTPS or the indexName is empty.

Applies to

SearchClient(Uri, String, TokenCredential)

Source:
SearchClient.cs
Source:
SearchClient.cs

Initializes a new instance of the SearchClient class for querying an index and uploading, merging, or deleting documents.

public SearchClient (Uri endpoint, string indexName, Azure.Core.TokenCredential tokenCredential);
new Azure.Search.Documents.SearchClient : Uri * string * Azure.Core.TokenCredential -> Azure.Search.Documents.SearchClient
Public Sub New (endpoint As Uri, indexName As String, tokenCredential As TokenCredential)

Parameters

endpoint
Uri

Required. The URI endpoint of the Search Service. This is likely to be similar to "https://{search_service}.search.windows.net". The URI must use HTTPS.

indexName
String

Required. The name of the Search Index.

tokenCredential
TokenCredential

Required. The token credential used to authenticate requests against the Search service. See Use role-based authorization in Azure Cognitive Search for more information about role-based authorization in Azure Cognitive Search.

Exceptions

Thrown when the endpoint, indexName, or tokenCredential is null.

Thrown when the endpoint is not using HTTPS or the indexName is empty.

Applies to

SearchClient(Uri, String, AzureKeyCredential, SearchClientOptions)

Source:
SearchClient.cs
Source:
SearchClient.cs

Initializes a new instance of the SearchClient class for querying an index and uploading, merging, or deleting documents.

public SearchClient (Uri endpoint, string indexName, Azure.AzureKeyCredential credential, Azure.Search.Documents.SearchClientOptions options);
new Azure.Search.Documents.SearchClient : Uri * string * Azure.AzureKeyCredential * Azure.Search.Documents.SearchClientOptions -> Azure.Search.Documents.SearchClient
Public Sub New (endpoint As Uri, indexName As String, credential As AzureKeyCredential, options As SearchClientOptions)

Parameters

endpoint
Uri

Required. The URI endpoint of the Search Service. This is likely to be similar to "https://{search_service}.search.windows.net". The URI must use HTTPS.

indexName
String

Required. The name of the Search Index.

credential
AzureKeyCredential

Required. The API key credential used to authenticate requests against the search service. You need to use an admin key to modify the documents in a Search Index. See Create and manage api-keys for an Azure Cognitive Search service for more information about API keys in Azure Cognitive Search.

options
SearchClientOptions

Client configuration options for connecting to Azure Cognitive Search.

Exceptions

Thrown when the endpoint, indexName, or credential is null.

Thrown when the endpoint is not using HTTPS or the indexName is empty.

Applies to

SearchClient(Uri, String, TokenCredential, SearchClientOptions)

Source:
SearchClient.cs
Source:
SearchClient.cs

Initializes a new instance of the SearchClient class for querying an index and uploading, merging, or deleting documents.

public SearchClient (Uri endpoint, string indexName, Azure.Core.TokenCredential tokenCredential, Azure.Search.Documents.SearchClientOptions options);
new Azure.Search.Documents.SearchClient : Uri * string * Azure.Core.TokenCredential * Azure.Search.Documents.SearchClientOptions -> Azure.Search.Documents.SearchClient
Public Sub New (endpoint As Uri, indexName As String, tokenCredential As TokenCredential, options As SearchClientOptions)

Parameters

endpoint
Uri

Required. The URI endpoint of the Search Service. This is likely to be similar to "https://{search_service}.search.windows.net". The URI must use HTTPS.

indexName
String

Required. The name of the Search Index.

tokenCredential
TokenCredential

Required. The token credential used to authenticate requests against the Search service. See Use role-based authorization in Azure Cognitive Search for more information about role-based authorization in Azure Cognitive Search.

options
SearchClientOptions

Client configuration options for connecting to Azure Cognitive Search.

Exceptions

Thrown when the endpoint, indexName, or tokenCredential is null.

Thrown when the endpoint is not using HTTPS or the indexName is empty.

Applies to