Discovery.SuggestAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| SuggestAsync(SuggestConfig, CancellationToken) |
Get search suggestions by query criteria. |
| SuggestAsync(RequestContent, RequestContext) |
[Protocol Method] Get search suggestions by query criteria.
|
SuggestAsync(SuggestConfig, CancellationToken)
- Source:
- Discovery.cs
Get search suggestions by query criteria.
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Analytics.Purview.DataMap.SuggestResult>> SuggestAsync(Azure.Analytics.Purview.DataMap.SuggestConfig body, System.Threading.CancellationToken cancellationToken = default);
abstract member SuggestAsync : Azure.Analytics.Purview.DataMap.SuggestConfig * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Analytics.Purview.DataMap.SuggestResult>>
override this.SuggestAsync : Azure.Analytics.Purview.DataMap.SuggestConfig * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Analytics.Purview.DataMap.SuggestResult>>
Public Overridable Function SuggestAsync (body As SuggestConfig, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of SuggestResult))
Parameters
- body
- SuggestConfig
Body parameter.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
body is null.
Examples
This sample shows how to call SuggestAsync.
Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
Discovery client = new DataMapClient(endpoint, credential).GetDiscoveryClient(apiVersion: "2023-09-01");
SuggestConfig body = new SuggestConfig
{
Keywords = "exampledata",
Limit = 10,
Filter = BinaryData.FromObjectAsJson(new Dictionary<string, object>
{
["$id"] = "6982",
["and"] = new object[]
{
new Dictionary<string, object>
{
["$id"] = "6983",
["entityType"] = "azure_blob_path",
["includeSubTypes"] = false
}
}
}),
};
Response<SuggestResult> response = await client.SuggestAsync(body);
Applies to
SuggestAsync(RequestContent, RequestContext)
- Source:
- Discovery.cs
[Protocol Method] Get search suggestions by query criteria.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler SuggestAsync(SuggestConfig, CancellationToken) convenience overload with strongly typed models first.
public virtual System.Threading.Tasks.Task<Azure.Response> SuggestAsync(Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member SuggestAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.SuggestAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function SuggestAsync (content As RequestContent, Optional context As RequestContext = Nothing) As Task(Of Response)
Parameters
- content
- RequestContent
The content to send as the body of the request.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The response returned from the service.
Exceptions
content is null.
Service returned a non-success status code.
Examples
This sample shows how to call SuggestAsync and parse the result.
Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
Discovery client = new DataMapClient(endpoint, credential).GetDiscoveryClient(apiVersion: "2023-09-01");
using RequestContent content = RequestContent.Create(new
{
keywords = "exampledata",
filter = new Dictionary<string, object>
{
["$id"] = "6982",
["and"] = new object[]
{
new Dictionary<string, object>
{
["$id"] = "6983",
["entityType"] = "azure_blob_path",
["includeSubTypes"] = false
}
}
},
limit = 10,
});
Response response = await client.SuggestAsync(content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.ToString());