共用方式為


DocumentsOperationsExtensions.GetAsync Method

Definition

Overloads

GetAsync(IDocumentsOperations, String, IEnumerable<String>, SearchRequestOptions, CancellationToken)

Retrieves a document from the search index. https://docs.microsoft.com/rest/api/searchservice/Lookup-Document

GetAsync<T>(IDocumentsOperations, String, IEnumerable<String>, SearchRequestOptions, CancellationToken)

Retrieves a document from the search index. https://docs.microsoft.com/rest/api/searchservice/Lookup-Document

GetAsync(IDocumentsOperations, String, IEnumerable<String>, SearchRequestOptions, CancellationToken)

Source:
DocumentsOperationsExtensions.cs

Retrieves a document from the search index. https://docs.microsoft.com/rest/api/searchservice/Lookup-Document

public static System.Threading.Tasks.Task<Microsoft.Azure.Search.Models.Document> GetAsync (this Microsoft.Azure.Search.IDocumentsOperations operations, string key, System.Collections.Generic.IEnumerable<string> selectedFields = default, Microsoft.Azure.Search.Models.SearchRequestOptions searchRequestOptions = default, System.Threading.CancellationToken cancellationToken = default);
static member GetAsync : Microsoft.Azure.Search.IDocumentsOperations * string * seq<string> * Microsoft.Azure.Search.Models.SearchRequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Search.Models.Document>
<Extension()>
Public Function GetAsync (operations As IDocumentsOperations, key As String, Optional selectedFields As IEnumerable(Of String) = Nothing, Optional searchRequestOptions As SearchRequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Document)

Parameters

operations
IDocumentsOperations

The operations group for this extension method.

key
String

The key of the document to retrieve; See https://docs.microsoft.com/rest/api/searchservice/Naming-rules for the rules for constructing valid document keys.

selectedFields
IEnumerable<String>

List of field names to retrieve for the document; Any field not retrieved will be missing from the returned document.

searchRequestOptions
SearchRequestOptions

Additional parameters for the operation

cancellationToken
CancellationToken

The cancellation token.

Returns

The requested document.

Remarks

The non-generic overloads of the Get, GetAsync, and GetWithHttpMessagesAsync methods make a best-effort attempt to map JSON types in the response payload to .NET types. See GetWithHttpMessagesAsync(String, IEnumerable<String>, SearchRequestOptions, Dictionary<String,List<String>>, CancellationToken) for more information.

Applies to

GetAsync<T>(IDocumentsOperations, String, IEnumerable<String>, SearchRequestOptions, CancellationToken)

Source:
DocumentsOperationsExtensions.cs

Retrieves a document from the search index. https://docs.microsoft.com/rest/api/searchservice/Lookup-Document

public static System.Threading.Tasks.Task<T> GetAsync<T> (this Microsoft.Azure.Search.IDocumentsOperations operations, string key, System.Collections.Generic.IEnumerable<string> selectedFields = default, Microsoft.Azure.Search.Models.SearchRequestOptions searchRequestOptions = default, System.Threading.CancellationToken cancellationToken = default);
static member GetAsync : Microsoft.Azure.Search.IDocumentsOperations * string * seq<string> * Microsoft.Azure.Search.Models.SearchRequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'T>
<Extension()>
Public Function GetAsync(Of T) (operations As IDocumentsOperations, key As String, Optional selectedFields As IEnumerable(Of String) = Nothing, Optional searchRequestOptions As SearchRequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of T)

Type Parameters

T

The CLR type that maps to the index schema. Instances of this type can be retrieved as documents from the index.

Parameters

operations
IDocumentsOperations

The operations group for this extension method.

key
String

The key of the document to retrieve; See https://docs.microsoft.com/rest/api/searchservice/Naming-rules for the rules for constructing valid document keys.

selectedFields
IEnumerable<String>

List of field names to retrieve for the document; Any field not retrieved will have null or default as its corresponding property value in the returned object. All retrievable fields are included in the result by default.

searchRequestOptions
SearchRequestOptions

Additional parameters for the operation

cancellationToken
CancellationToken

The cancellation token.

Returns

Task<T>

The requested document.

Remarks

The generic overloads of the Get, GetAsync, and GetWithHttpMessagesAsync methods support mapping of Azure Search field types to .NET types via the type parameter T. See GetWithHttpMessagesAsync<T>(String, IEnumerable<String>, SearchRequestOptions, Dictionary<String,List<String>>, CancellationToken) for more details on the type mapping.

Applies to