< Docs
  • Java
    • v1


The MilvusClient interface. This method gets entity(s) based on the primary field ids. Note that the order of the returned entities can not be guaranteed.

R<GetResponse> get(GetIdsParam requestParam);


Use the GetIdsParam.Builder to construct a GetIdsParam object.

import io.milvus.param.highlevel.dml.GetIdsParam;
GetIdsParam.Builder builder = GetIdsParam.newBuilder();

Methods of GetIdsParam.Builder:

Method Description Parameters
withCollectionName(String collectionName) Sets the target collection name. Collection name cannot be empty or null. collectionName: The name of the collection to insert data into.
withPrimaryIds(List\ primaryIds) Specifies id fields. ID cannot be empty or null.
Note only support the value of primary key.
primaryIds: a list of primary field key objects.
addPrimaryId(T primaryId) Specifies primaryField id. PrimaryId cannot be empty or null.
Note only support the value of primary key.
primaryId: The id of primary field key.
withOutputFields(List\ outputFields) Specifies output fields (Optional). outputFields: A list of output field you need.
withConsistencyLevel(ConsistencyLevelEnum consistencyLevel) Consistency level used in the get. If no level is specified, will use default consistency. Please refer to ConsistencyLevelEnum in Misc. consistencyLevel: The consistency level used in the get.
build() Constructs an GetIdsParam object. N/A

The can throw the following exceptions:

  • ParamException: error if the parameter is invalid.


This method catches all the exceptions and returns an R<GetResponse> object.

  • If the API fails on the server side, it returns the error code and message from the server.

  • If the API fails by RPC exception, it returns R.Status.Unknown and the error message of the exception.

  • If the API succeeds, it returns a valid GetResponse held by the R template.


import io.milvus.param.*;
import io.milvus.response.QueryResultsWrapper;
import io.milvus.response.FieldDataWrapper;
import io.milvus.grpc.QueryResults;

List<String> ids = Lists.newArrayList("441966745769900131", "441966745769900133");
GetIdsParam getParam = GetIdsParam.newBuilder()

R<GetResponse> response = client.get(param)
if (response.getStatus() != R.Status.Success.getCode()) {

for (QueryResultsWrapper.RowRecord rowRecord : response.getData().getRowRecords()) {


Was this page helpful?