Class Data

Methods

flush

  • Milvus temporarily stores the inserted vectors in the memory. Call flush() to flush them to the disk.

    Parameters

    • data: FlushReq
      Property Type Description
      collection_names string[] collection name array

    Returns Promise<FlushResult>

    Property Description
    status { error_code: number,reason:string }

    Example

     new milvusClient(MILUVS_IP).dataManager.flush({
        collection_names: ['my_collection'],
     });
    

insert

  • Insert data into milvus.

    Parameters

    • data: InsertReq
      Property Type Description
      collection_name string collection name
      partition_name(optional) string partition name
      fields_data { [x: string]: any }[] field type is binary, the vector data length need to be dimension / 8query
      hash_keys(optional) Number[] It's hash value depend on primarykey value

    Returns Promise<MutationResult>

    Property Description
    status { error_code: number,reason:string }
    succ_index Insert successful index array
    err_index Insert failed index array
    IDs Insert successful id array

    Example

     new milvusClient(MILUVS_IP).dataManager.insert({
       collection_name: COLLECTION_NAME,
       fields_data: [{
         vector_field: [1,2,2,4],
         scalar_field: 1
       }]
     });
    

query

  • Query milvus data. Now we only support like: fieldname in [id1,id2,id3]

    Parameters

    • data: QueryReq
      Property Type Description
      collection_name string collection name
      expr string scalar fields filter expression
      partitions_names(optional) string[] partition name array
      output_fields string[] collection fields you want to return

    Returns Promise<QueryResult>

    Property Description
    status { error_code: number,reason:string }
    fields_data all fields data you defined in output_fields

    Example

     new milvusClient(MILUVS_IP).dataManager.query({
       collection_name: 'my_collection',
       expr: "age in [1,2,3,4,5,6,7,8]",
       output_fields: ["age"],
     });
    

search

  • vector similarity search

    Parameters

    • data: SearchReq
      Property Type Description
      collection_name string collection name
      partition_names(optional) string[] partition name array
      expr(optional) string scalar field filter
      search_params SearchParam[] search Params: {key: "anns_field" | "topk" | "metric_type" | "params";value: string;}
      vectors number[][] the vector value you want to search
      output_fields(optional) string[] define function will return which fields data
      vector_type enum Binary field -> 100, Float field -> 101

    Returns Promise<SearchResults>

    Property Description
    status { error_code: number,reason:string }
    succ_index Insert successful index array
    err_index Insert failed index array
    IDs Insert successful id array

    Example

     new milvusClient(MILUVS_IP).dataManager.search({
      collection_name: COLLECTION_NAME,
      expr: "",
      vectors: [[1, 2, 3, 4]],
      search_params: [
        { key: "anns_field", value: "float_vector" },
        { key: "topk", value: "4" },
        { key: "metric_type", value: "IP" },
        { key: "params", value: JSON.stringify({ nprobe: 1024 }) },
      ],
      output_fields: ["age", "time"],
      vector_type: 100,
     });