milvus-logo
Star
0
Forks
0
Get Started

search()

Conducts a vector search.

Invocation

new milvusClient(MILUVS_ADDRESS).dataManager.search(SearchReq);

Parameter

SearchReq(object)

ParameterDescriptiontyperequired
collection_nameCollection nameStringtrue
search_paramsSearch parametersSearchParamstrue
vectorsOriginal vector to search withNumber[][]true
vector_typeSearch parametersVectorTypestrue
output_fields(optional)Vector or scalar field to be returnedString[]false
travel_timestamp(optional)Use this timestamp we can time travel in vector search.numberfalse
partitions_names(optional)Array of partition namesstring[]false
expr(optional)Scalar field filter expressionStringfalse

SearchParams(object)

ParameterDescriptiontyperequired
anns_fieldvector field nameStringtrue
topksearch result countsstring[]false
metric_typemetric typeMetricTypesfalse
paramsspecial parametersSearchParamtrue

MetricTypes(string)

ValueDescription
L2Euclidean distance
IPInner product
HAMMINGHamming distance
JACCARDJaccard distance
TANIMOTOTanimoto distance
SUBSTRUCTURESuperstructure
SUPERSTRUCTURESubstructure

VectorTypes

ValueDescription
100Binary
101Float

SearchParam

Please refer https://milvus.io/docs/index.md

Example

new milvusClient(MILUVS_ADDRESS).dataManager.search({
  collection_name: 'my-collection-name',
  expr: "",
  vectors: [[1, 2, 3, 4]],
  search_params: {
    anns_field: 'my-vector-field-name',
    topk: 4,
    metric_type: "L2",
    params: JSON.stringify({ nprobe: 1024 }),
  },
  output_fields: ["age", "time"],
  vector_type: 100,
});

Return

// search return