milvus-logo
LFAI
< Docs
  • Node

query()

This method performs a vector query.

You must load the collection before searching or querying

Example

import { MilvusClient } from "@zilliz/milvus2-sdk-node";

new milvusClient(MILUVS_ADDRESS).query({
  collection_name: "my_collection",
  expr: "age > 0",
  output_fields: ["age"],
  limit: 1000,
  offset: 2,
});

Response

// query returns
{
  status: { error_code: 'Success', reason: '' },
  data: [
    { age: '434848878802248081' },
    ...999 more items,
  ]
}

Parameters

ParametersDescriptionType
collection_nameName of the collection to search onString
output_fieldsVector or scalar field to be returnsedString[]
expr or filterExpression to filter the dataString
limitSets a value to limit the returned number of entities. It must be a positive integer. The default value is 0, indicating that all entities are returned without a limit.Number
offsetSets a position, the returned entities before which will be ignored. This parameter works only when the limit value is specified. The default value is 0, starting from beginning of the returned set of entities.Number
partitions_names?An array of the names of the partitions to search on.String[]
timeout?This parameter is used to specify the length of time, in milliseconds, that the RPC (Remote Procedure Call) is allowed to run. If no value is provided, the default is undefined.Number