diff --git a/client/go.mod b/client/go.mod index aad9018aaf..863df31749 100644 --- a/client/go.mod +++ b/client/go.mod @@ -13,6 +13,7 @@ require ( github.com/stretchr/testify v1.8.4 github.com/tidwall/gjson v1.17.1 go.uber.org/atomic v1.10.0 + golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2 google.golang.org/grpc v1.57.1 google.golang.org/protobuf v1.33.0 ) @@ -107,7 +108,6 @@ require ( go.uber.org/multierr v1.7.0 // indirect go.uber.org/zap v1.20.0 // indirect golang.org/x/crypto v0.22.0 // indirect - golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2 // indirect golang.org/x/net v0.24.0 // indirect golang.org/x/sync v0.1.0 // indirect golang.org/x/sys v0.20.0 // indirect diff --git a/client/index.go b/client/index.go index 7932048463..2f88e3b1fd 100644 --- a/client/index.go +++ b/client/index.go @@ -126,9 +126,17 @@ func (c *Client) ListIndexes(ctx context.Context, opt ListIndexOption, callOptio return indexes, err } -func (c *Client) DescribeIndex(ctx context.Context, opt DescribeIndexOption, callOptions ...grpc.CallOption) (index.Index, error) { +type IndexDescription struct { + index.Index + State index.IndexState + PendingIndexRows int64 + TotalRows int64 + IndexedRows int64 +} + +func (c *Client) DescribeIndex(ctx context.Context, opt DescribeIndexOption, callOptions ...grpc.CallOption) (IndexDescription, error) { req := opt.Request() - var idx index.Index + var idx IndexDescription err := c.callService(func(milvusService milvuspb.MilvusServiceClient) error { resp, err := milvusService.DescribeIndex(ctx, req, callOptions...) @@ -141,7 +149,13 @@ func (c *Client) DescribeIndex(ctx context.Context, opt DescribeIndexOption, cal } for _, idxDef := range resp.GetIndexDescriptions() { if idxDef.GetIndexName() == req.GetIndexName() { - idx = index.NewGenericIndex(idxDef.GetIndexName(), entity.KvPairsMap(idxDef.GetParams())) + idx = IndexDescription{ + Index: index.NewGenericIndex(idxDef.GetIndexName(), entity.KvPairsMap(idxDef.GetParams())), + State: index.IndexState(idxDef.GetState()), + PendingIndexRows: idxDef.GetPendingIndexRows(), + IndexedRows: idxDef.GetIndexedRows(), + TotalRows: idxDef.GetTotalRows(), + } } } return nil