milvus-logo
LFAI
< Docs
  • C#

QueryAsync()

Retrieves rows from a collection via scalar filtering based on a boolean expression.

Invocation

await collection.QueryAsync(expression, parameters = null, cancellationToken = default);

Parameters

ParameterDescriptionTypeRequired
expressionA boolean expression determining which rows are to be returned.stringTrue
parametersVarious additional optional parameters to configure the query.QueryParameters?False
cancellationTokenThe token to monitor for cancellation requests. The default value is CancellationToken.None.CancellationTokenFalse

Return

A list of FieldData instances with the query results.

Example

var results = await Client.GetCollection("book").QueryAsync(
    expression: "book_id in [2,4,6,8]",
    new QueryParameters
    {
        Offset = 0,
        Limit = 10,
        OutputFields = { "book_id", "book_intro" }
    });