Documentation ¶
Overview ¶
Package client provides milvus client functions
Index ¶
- Constants
- Variables
- func AuthenticationInterceptor(ctx context.Context, username, password string) context.Context
- func CreateAuthenticationStreamInterceptor(username, password string) grpc.StreamClientInterceptor
- func CreateAuthenticationUnaryInterceptor(username, password string) grpc.UnaryClientInterceptor
- func PKs2Expr(ids entity.Column) string
- func RetryOnRateLimitInterceptor(maxRetry uint, backoffFunc grpc_retry.BackoffFuncContext) grpc.UnaryClientInterceptor
- func SetFieldValue(field *entity.Field, f reflect.Value, fieldData *schema.FieldData, idx int) error
- func WithClientRequestID(ctx context.Context, reqID string) context.Context
- func WithDebugLogLevel(ctx context.Context) context.Context
- func WithErrorLogLevel(ctx context.Context) context.Context
- func WithInfoLogLevel(ctx context.Context) context.Context
- func WithWarnLogLevel(ctx context.Context) context.Context
- type BulkInsertOption
- type Client
- func NewDefaultGrpcClient(ctx context.Context, addr string) (Client, error)
- func NewDefaultGrpcClientWithAuth(ctx context.Context, addr, username, password string) (Client, error)
- func NewDefaultGrpcClientWithTLSAuth(ctx context.Context, addr, username, password string) (Client, error)
- func NewDefaultGrpcClientWithURI(ctx context.Context, uri, username, password string) (Client, error)
- func NewGrpcClient(ctx context.Context, addr string, dialOptions ...grpc.DialOption) (Client, error)
- type CreateCollectionOption
- type ErrCollectionNotExists
- type ErrPartitionNotExists
- type ErrServiceFailed
- type GrpcClient
- func (c *GrpcClient) AddUserRole(ctx context.Context, username string, role string) error
- func (c *GrpcClient) AlterAlias(ctx context.Context, collName string, alias string) error
- func (c *GrpcClient) AlterCollection(ctx context.Context, collName string, attrs ...entity.CollectionAttribute) error
- func (c *GrpcClient) BulkInsert(ctx context.Context, collName string, partitionName string, files []string, ...) (int64, error)
- func (c *GrpcClient) CalcDistance(ctx context.Context, collName string, partitions []string, ...) (entity.Column, error)
- func (c *GrpcClient) Close() error
- func (c *GrpcClient) CreateAlias(ctx context.Context, collName string, alias string) error
- func (c *GrpcClient) CreateCollection(ctx context.Context, collSchema *entity.Schema, shardNum int32, ...) error
- func (c *GrpcClient) CreateCollectionByRow(ctx context.Context, row entity.Row, shardNum int32) error
- func (c *GrpcClient) CreateCredential(ctx context.Context, username string, password string) error
- func (c *GrpcClient) CreateIndex(ctx context.Context, collName string, fieldName string, idx entity.Index, ...) error
- func (c *GrpcClient) CreatePartition(ctx context.Context, collName string, partitionName string) error
- func (c *GrpcClient) CreateResourceGroup(ctx context.Context, rgName string) error
- func (c *GrpcClient) CreateRole(ctx context.Context, name string) error
- func (c *GrpcClient) DeleteByPks(ctx context.Context, collName string, partitionName string, ids entity.Column) error
- func (c *GrpcClient) DeleteCredential(ctx context.Context, username string) error
- func (c *GrpcClient) DescribeCollection(ctx context.Context, collName string) (*entity.Collection, error)
- func (c *GrpcClient) DescribeIndex(ctx context.Context, collName string, fieldName string, opts ...IndexOption) ([]entity.Index, error)
- func (c *GrpcClient) DescribeResourceGroup(ctx context.Context, rgName string) (*entity.ResourceGroup, error)
- func (c *GrpcClient) DropAlias(ctx context.Context, alias string) error
- func (c *GrpcClient) DropCollection(ctx context.Context, collName string) error
- func (c *GrpcClient) DropIndex(ctx context.Context, collName string, fieldName string, opts ...IndexOption) error
- func (c *GrpcClient) DropPartition(ctx context.Context, collName string, partitionName string) error
- func (c *GrpcClient) DropResourceGroup(ctx context.Context, rgName string) error
- func (c *GrpcClient) DropRole(ctx context.Context, name string) error
- func (c *GrpcClient) Flush(ctx context.Context, collName string, async bool) error
- func (c *GrpcClient) GetBulkInsertState(ctx context.Context, taskID int64) (*entity.BulkInsertTaskState, error)
- func (c *GrpcClient) GetCollectionStatistics(ctx context.Context, collName string) (map[string]string, error)
- func (c *GrpcClient) GetCompactionState(ctx context.Context, id int64) (entity.CompactionState, error)
- func (c *GrpcClient) GetCompactionStateWithPlans(ctx context.Context, id int64) (entity.CompactionState, []entity.CompactionPlan, error)
- func (c *GrpcClient) GetIndexBuildProgress(ctx context.Context, collName string, fieldName string, opts ...IndexOption) (total, indexed int64, err error)
- func (c *GrpcClient) GetIndexState(ctx context.Context, collName string, fieldName string, opts ...IndexOption) (entity.IndexState, error)
- func (c *GrpcClient) GetLoadState(ctx context.Context, collName string, partitionNames []string) (entity.LoadState, error)
- func (c *GrpcClient) GetLoadingProgress(ctx context.Context, collName string, partitionNames []string) (int64, error)
- func (c *GrpcClient) GetPersistentSegmentInfo(ctx context.Context, collName string) ([]*entity.Segment, error)
- func (c *GrpcClient) GetQuerySegmentInfo(ctx context.Context, collName string) ([]*entity.Segment, error)
- func (c *GrpcClient) GetReplicas(ctx context.Context, collName string) ([]*entity.ReplicaGroup, error)
- func (c *GrpcClient) GetVersion(ctx context.Context) (string, error)
- func (c *GrpcClient) Grant(ctx context.Context, role string, objectType entity.PriviledgeObjectType, ...) error
- func (c *GrpcClient) HasCollection(ctx context.Context, collName string) (bool, error)
- func (c *GrpcClient) HasPartition(ctx context.Context, collName string, partitionName string) (bool, error)
- func (c *GrpcClient) Insert(ctx context.Context, collName string, partitionName string, ...) (entity.Column, error)
- func (c *GrpcClient) InsertByRows(ctx context.Context, collName string, partitionName string, rows []entity.Row) (entity.Column, error)
- func (c *GrpcClient) ListBulkInsertTasks(ctx context.Context, collName string, limit int64) ([]*entity.BulkInsertTaskState, error)
- func (c *GrpcClient) ListCollections(ctx context.Context) ([]*entity.Collection, error)
- func (c *GrpcClient) ListCredUsers(ctx context.Context) ([]string, error)
- func (c *GrpcClient) ListResourceGroups(ctx context.Context) ([]string, error)
- func (c *GrpcClient) ListRoles(ctx context.Context) ([]entity.Role, error)
- func (c *GrpcClient) ListUsers(ctx context.Context) ([]entity.User, error)
- func (c *GrpcClient) LoadCollection(ctx context.Context, collName string, async bool, opts ...LoadCollectionOption) error
- func (c *GrpcClient) LoadPartitions(ctx context.Context, collName string, partitionNames []string, async bool) error
- func (c *GrpcClient) ManualCompaction(ctx context.Context, collName string, toleranceDuration time.Duration) (int64, error)
- func (c *GrpcClient) Query(ctx context.Context, collectionName string, partitionNames []string, ...) ([]entity.Column, error)
- func (c *GrpcClient) QueryByPks(ctx context.Context, collectionName string, partitionNames []string, ...) ([]entity.Column, error)
- func (c *GrpcClient) ReleaseCollection(ctx context.Context, collName string) error
- func (c *GrpcClient) ReleasePartitions(ctx context.Context, collName string, partitionNames []string) error
- func (c *GrpcClient) RemoveUserRole(ctx context.Context, username string, role string) error
- func (c *GrpcClient) Revoke(ctx context.Context, role string, objectType entity.PriviledgeObjectType, ...) error
- func (c *GrpcClient) Search(ctx context.Context, collName string, partitions []string, expr string, ...) ([]SearchResult, error)
- func (c *GrpcClient) ShowCollection(ctx context.Context, collName string) (*entity.Collection, error)
- func (c *GrpcClient) ShowPartitions(ctx context.Context, collName string) ([]*entity.Partition, error)
- func (c *GrpcClient) TransferNode(ctx context.Context, sourceRg, targetRg string, nodesNum int32) error
- func (c *GrpcClient) TransferReplica(ctx context.Context, sourceRg, targetRg string, collectionName string, ...) error
- func (c *GrpcClient) UpdateCredential(ctx context.Context, username string, oldPassword string, newPassword string) error
- type IndexOption
- type LoadCollectionOption
- type SearchQueryOption
- type SearchQueryOptionFunc
- func WithGuaranteeTimestamp(gt uint64) SearchQueryOptionFunc
- func WithIgnoreGrowing() SearchQueryOptionFunc
- func WithLimit(limit int64) SearchQueryOptionFunc
- func WithOffset(offset int64) SearchQueryOptionFunc
- func WithSearchQueryConsistencyLevel(cl entity.ConsistencyLevel) SearchQueryOptionFunc
- func WithTravelTimestamp(tt uint64) SearchQueryOptionFunc
- type SearchResult
- type SearchResultByRows
Constants ¶
const ( StrongTimestamp uint64 = 0 EventuallyTimestamp uint64 = 1 BoundedTimestamp uint64 = 2 )
Magical timestamps for communicating with server
const (
RetryOnRateLimit ctxKey = iota
)
Variables ¶
var ( //ErrClientNotReady error indicates client not ready ErrClientNotReady = errors.New("client not ready") //ErrStatusNil error indicates response has nil status ErrStatusNil = errors.New("response status is nil") )
var DefaultGrpcOpts = []grpc.DialOption{ grpc.WithBlock(), grpc.WithKeepaliveParams(keepalive.ClientParameters{ Time: 5 * time.Second, Timeout: 10 * time.Second, PermitWithoutStream: true, }), grpc.WithConnectParams(grpc.ConnectParams{ Backoff: backoff.Config{ BaseDelay: 100 * time.Millisecond, Multiplier: 1.6, Jitter: 0.2, MaxDelay: 3 * time.Second, }, MinConnectTimeout: 3 * time.Second, }), }
var ( // ErrFieldTypeNotMatch error for field type not match ErrFieldTypeNotMatch = errors.New("field type not matched") )
var MaxBackOff = 60 * time.Second
var MetaCache = metaCache{ // contains filtered or unexported fields }
Functions ¶
func AuthenticationInterceptor ¶ added in v2.1.0
AuthenticationInterceptor appends credential into context metadata
func CreateAuthenticationStreamInterceptor ¶ added in v2.1.0
func CreateAuthenticationStreamInterceptor(username, password string) grpc.StreamClientInterceptor
CreateAuthenticationStreamInterceptor creates a stream interceptor for authentication
func CreateAuthenticationUnaryInterceptor ¶ added in v2.1.0
func CreateAuthenticationUnaryInterceptor(username, password string) grpc.UnaryClientInterceptor
CreateAuthenticationUnaryInterceptor creates a unary interceptor for authentication
func RetryOnRateLimitInterceptor ¶ added in v2.2.0
func RetryOnRateLimitInterceptor(maxRetry uint, backoffFunc grpc_retry.BackoffFuncContext) grpc.UnaryClientInterceptor
RetryOnRateLimitInterceptor returns a new retrying unary client interceptor.
func SetFieldValue ¶
func SetFieldValue(field *entity.Field, f reflect.Value, fieldData *schema.FieldData, idx int) error
SetFieldValue set row field value with reflection
func WithClientRequestID ¶ added in v2.1.2
func WithDebugLogLevel ¶ added in v2.1.2
func WithErrorLogLevel ¶ added in v2.1.2
Types ¶
type BulkInsertOption ¶ added in v2.2.0
type BulkInsertOption func(request *server.ImportRequest)
BulkInsertOption is an option that is used to modify ImportRequest
func WithEndTs ¶ added in v2.2.0
func WithEndTs(endTs int64) BulkInsertOption
WithEndTs specifies a specific endTs
func WithStartTs ¶ added in v2.2.0
func WithStartTs(startTs int64) BulkInsertOption
WithStartTs specifies a specific startTs
type Client ¶
type Client interface { // Close close the remaining connection resources Close() error // ListCollections list collections from connection ListCollections(ctx context.Context) ([]*entity.Collection, error) // CreateCollection create collection using provided schema CreateCollection(ctx context.Context, schema *entity.Schema, shardsNum int32, opts ...CreateCollectionOption) error // DescribeCollection describe collection meta DescribeCollection(ctx context.Context, collName string) (*entity.Collection, error) // DropCollection drop the specified collection DropCollection(ctx context.Context, collName string) error // GetCollectionStatistics get collection statistics GetCollectionStatistics(ctx context.Context, collName string) (map[string]string, error) // LoadCollection load collection into memory LoadCollection(ctx context.Context, collName string, async bool, opts ...LoadCollectionOption) error // ReleaseCollection release loaded collection ReleaseCollection(ctx context.Context, collName string) error // HasCollection check whether collection exists HasCollection(ctx context.Context, collName string) (bool, error) // AlterCollection AlterCollection(ctx context.Context, collName string, attrs ...entity.CollectionAttribute) error // CreateAlias creates an alias for collection CreateAlias(ctx context.Context, collName string, alias string) error // DropAlias drops the specified Alias DropAlias(ctx context.Context, alias string) error // AlterAlias changes collection alias to provided alias AlterAlias(ctx context.Context, collName string, alias string) error // GetReplicas gets the replica groups as well as their querynodes and shards information GetReplicas(ctx context.Context, collName string) ([]*entity.ReplicaGroup, error) // CreateCredential create new user and password CreateCredential(ctx context.Context, username string, password string) error // UpdateCredential update password for a user UpdateCredential(ctx context.Context, username string, oldPassword string, newPassword string) error // DeleteCredential delete a user DeleteCredential(ctx context.Context, username string) error // ListCredUsers list all usernames ListCredUsers(ctx context.Context) ([]string, error) // CreatePartition create partition for collection CreatePartition(ctx context.Context, collName string, partitionName string) error // DropPartition drop partition from collection DropPartition(ctx context.Context, collName string, partitionName string) error // ShowPartitions list all partitions from collection ShowPartitions(ctx context.Context, collName string) ([]*entity.Partition, error) // HasPartition check whether partition exists in collection HasPartition(ctx context.Context, collName string, partitionName string) (bool, error) // LoadPartitions load partitions into memory LoadPartitions(ctx context.Context, collName string, partitionNames []string, async bool) error // ReleasePartitions release partitions ReleasePartitions(ctx context.Context, collName string, partitionNames []string) error // -- segment -- GetPersistentSegmentInfo(ctx context.Context, collName string) ([]*entity.Segment, error) // CreateIndex create index for field of specified collection // currently index naming is not supported, so only one index on vector field is supported CreateIndex(ctx context.Context, collName string, fieldName string, idx entity.Index, async bool, opts ...IndexOption) error // DescribeIndex describe index on collection // currently index naming is not supported, so only one index on vector field is supported DescribeIndex(ctx context.Context, collName string, fieldName string, opts ...IndexOption) ([]entity.Index, error) // DropIndex drop index from collection with specified field name DropIndex(ctx context.Context, collName string, fieldName string, opts ...IndexOption) error // GetIndexState get index state with specified collection and field name // index naming is not supported yet GetIndexState(ctx context.Context, collName string, fieldName string, opts ...IndexOption) (entity.IndexState, error) // Insert column-based data into collection, returns id column values Insert(ctx context.Context, collName string, partitionName string, columns ...entity.Column) (entity.Column, error) // Flush flush collection, specified Flush(ctx context.Context, collName string, async bool) error // DeleteByPks deletes entries related to provided primary keys DeleteByPks(ctx context.Context, collName string, partitionName string, ids entity.Column) error // Search search with bool expression Search(ctx context.Context, collName string, partitions []string, expr string, outputFields []string, vectors []entity.Vector, vectorField string, metricType entity.MetricType, topK int, sp entity.SearchParam, opts ...SearchQueryOptionFunc) ([]SearchResult, error) // QueryByPks query record by specified primary key(s). QueryByPks(ctx context.Context, collectionName string, partitionNames []string, ids entity.Column, outputFields []string, opts ...SearchQueryOptionFunc) ([]entity.Column, error) // Query performs query records with boolean expression. Query(ctx context.Context, collectionName string, partitionNames []string, expr string, outputFields []string, opts ...SearchQueryOptionFunc) ([]entity.Column, error) // CalcDistance calculate the distance between vectors specified by ids or provided CalcDistance(ctx context.Context, collName string, partitions []string, metricType entity.MetricType, opLeft, opRight entity.Column) (entity.Column, error) // CreateCollectionByRow create collection by row CreateCollectionByRow(ctx context.Context, row entity.Row, shardNum int32) error // InsertByRows insert by rows InsertByRows(ctx context.Context, collName string, paritionName string, rows []entity.Row) (entity.Column, error) // ManualCompaction triggers a compaction on provided collection ManualCompaction(ctx context.Context, collName string, toleranceDuration time.Duration) (int64, error) // GetCompactionState get compaction state of provided compaction id GetCompactionState(ctx context.Context, id int64) (entity.CompactionState, error) // GetCompactionStateWithPlans get compaction state with plans of provided compaction id GetCompactionStateWithPlans(ctx context.Context, id int64) (entity.CompactionState, []entity.CompactionPlan, error) // BulkInsert import data files(json, numpy, etc.) on MinIO/S3 storage, read and parse them into sealed segments BulkInsert(ctx context.Context, collName string, partitionName string, files []string, opts ...BulkInsertOption) (int64, error) // GetBulkInsertState checks import task state GetBulkInsertState(ctx context.Context, taskID int64) (*entity.BulkInsertTaskState, error) // ListBulkInsertTasks list state of all import tasks ListBulkInsertTasks(ctx context.Context, collName string, limit int64) ([]*entity.BulkInsertTaskState, error) // CreateRole creates a role entity in Milvus. CreateRole(ctx context.Context, name string) error // DropRole drops a role entity in Milvus. DropRole(ctx context.Context, name string) error // AddUserRole adds one role for user. AddUserRole(ctx context.Context, username string, role string) error // RemoveUserRole removes one role from user. RemoveUserRole(ctx context.Context, username string, role string) error // ListRoles lists the role objects in system. ListRoles(ctx context.Context) ([]entity.Role, error) // ListUsers lists the user objects in system. ListUsers(ctx context.Context) ([]entity.User, error) // Grant adds object privileged for role. Grant(ctx context.Context, role string, objectType entity.PriviledgeObjectType, object string) error // Revoke removes privilege from role. Revoke(ctx context.Context, role string, objectType entity.PriviledgeObjectType, object string) error // GetLoadingProgress get the collection or partitions loading progress GetLoadingProgress(ctx context.Context, collectionName string, partitionNames []string) (int64, error) // GetLoadState get the collection or partitions load state GetLoadState(ctx context.Context, collectionName string, partitionNames []string) (entity.LoadState, error) // ListResourceGroups returns list of resource group names in current Milvus instance. ListResourceGroups(ctx context.Context) ([]string, error) // CreateResourceGroup creates a resource group with provided name. CreateResourceGroup(ctx context.Context, rgName string) error // DescribeResourceGroup returns resource groups information. DescribeResourceGroup(ctx context.Context, rgName string) (*entity.ResourceGroup, error) // DropResourceGroup drops the resource group with provided name. DropResourceGroup(ctx context.Context, rgName string) error // TransferNode transfers querynodes between resource groups. TransferNode(ctx context.Context, sourceRg, targetRg string, nodesNum int32) error // TransferReplica transfer collection replicas between source,target resource group. TransferReplica(ctx context.Context, sourceRg, targetRg string, collectionName string, replicaNum int64) error // GetVersion get milvus version GetVersion(ctx context.Context) (string, error) }
Client is the interface used to communicate with Milvus
func NewDefaultGrpcClient ¶ added in v2.1.2
func NewDefaultGrpcClientWithAuth ¶ added in v2.1.2
func NewDefaultGrpcClientWithAuth(ctx context.Context, addr, username, password string) (Client, error)
NewDefaultGrpcClientWithAuth disable transport security
func NewDefaultGrpcClientWithTLSAuth ¶ added in v2.1.2
func NewDefaultGrpcClientWithTLSAuth(ctx context.Context, addr, username, password string) (Client, error)
NewDefaultGrpcClientWithTLSAuth enable transport security
func NewDefaultGrpcClientWithURI ¶ added in v2.2.0
func NewGrpcClient ¶
func NewGrpcClient(ctx context.Context, addr string, dialOptions ...grpc.DialOption) (Client, error)
NewGrpcClient create client with grpc addr the `Connect` API will be called for you dialOptions contains the dial option(s) that control the grpc dialing process
type CreateCollectionOption ¶ added in v2.1.0
type CreateCollectionOption func(*server.CreateCollectionRequest)
CreateCollectionOption is an option that is used to modify CreateCollectionRequest
func WithConsistencyLevel ¶ added in v2.1.0
func WithConsistencyLevel(cl entity.ConsistencyLevel) CreateCollectionOption
WithConsistencyLevel specifies a specific ConsistencyLevel, rather than using the default ReaderProperties.
type ErrCollectionNotExists ¶
type ErrCollectionNotExists struct {
// contains filtered or unexported fields
}
ErrCollectionNotExists indicates the collection with specified collection name does not exist
func (ErrCollectionNotExists) Error ¶
func (e ErrCollectionNotExists) Error() string
Error implement error
type ErrPartitionNotExists ¶
type ErrPartitionNotExists struct {
// contains filtered or unexported fields
}
ErrPartitionNotExists indicates the partition of collection does not exist
func (ErrPartitionNotExists) Error ¶
func (e ErrPartitionNotExists) Error() string
Error implement error
type ErrServiceFailed ¶
type ErrServiceFailed error
ErrServiceFailed indicates error returns from milvus Service
type GrpcClient ¶ added in v2.2.0
type GrpcClient struct { Conn *grpc.ClientConn // grpc connection instance Service server.MilvusServiceClient // Service client stub }
GrpcClient, uses default grpc Service definition to connect with Milvus2.0
func (*GrpcClient) AddUserRole ¶ added in v2.2.0
AddUserRole adds one role for user.
func (*GrpcClient) AlterAlias ¶ added in v2.2.0
AlterAlias changes collection alias to provided alias
func (*GrpcClient) AlterCollection ¶ added in v2.2.2
func (c *GrpcClient) AlterCollection(ctx context.Context, collName string, attrs ...entity.CollectionAttribute) error
AlterCollection changes the collection attribute.
func (*GrpcClient) BulkInsert ¶ added in v2.2.0
func (c *GrpcClient) BulkInsert(ctx context.Context, collName string, partitionName string, files []string, opts ...BulkInsertOption) (int64, error)
BulkInsert data files(json, numpy, etc.) on MinIO/S3 storage, read and parse them into sealed segments
func (*GrpcClient) CalcDistance ¶ added in v2.2.0
func (*GrpcClient) Close ¶ added in v2.2.0
func (c *GrpcClient) Close() error
Close close the connection
func (*GrpcClient) CreateAlias ¶ added in v2.2.0
CreateAlias creates an alias for collection
func (*GrpcClient) CreateCollection ¶ added in v2.2.0
func (c *GrpcClient) CreateCollection(ctx context.Context, collSchema *entity.Schema, shardNum int32, opts ...CreateCollectionOption) error
CreateCollection create collection with specified schema
func (*GrpcClient) CreateCollectionByRow ¶ added in v2.2.0
func (c *GrpcClient) CreateCollectionByRow(ctx context.Context, row entity.Row, shardNum int32) error
CreateCollectionByRow create collection by row
func (*GrpcClient) CreateCredential ¶ added in v2.2.0
CreateCredential create new user and password
func (*GrpcClient) CreateIndex ¶ added in v2.2.0
func (c *GrpcClient) CreateIndex(ctx context.Context, collName string, fieldName string, idx entity.Index, async bool, opts ...IndexOption) error
CreateIndex create index for collection Deprecated please use CreateIndexV2 instead.
func (*GrpcClient) CreatePartition ¶ added in v2.2.0
func (c *GrpcClient) CreatePartition(ctx context.Context, collName string, partitionName string) error
CreatePartition create partition for collection
func (*GrpcClient) CreateResourceGroup ¶ added in v2.2.1
func (c *GrpcClient) CreateResourceGroup(ctx context.Context, rgName string) error
CreateResourceGroup creates a resource group with provided name.
func (*GrpcClient) CreateRole ¶ added in v2.2.0
func (c *GrpcClient) CreateRole(ctx context.Context, name string) error
CreateRole creates a role entity in Milvus.
func (*GrpcClient) DeleteByPks ¶ added in v2.2.0
func (c *GrpcClient) DeleteByPks(ctx context.Context, collName string, partitionName string, ids entity.Column) error
DeleteByPks deletes entries related to provided primary keys
func (*GrpcClient) DeleteCredential ¶ added in v2.2.0
func (c *GrpcClient) DeleteCredential(ctx context.Context, username string) error
DeleteCredential delete a user
func (*GrpcClient) DescribeCollection ¶ added in v2.2.0
func (c *GrpcClient) DescribeCollection(ctx context.Context, collName string) (*entity.Collection, error)
DescribeCollection describe the collection by name
func (*GrpcClient) DescribeIndex ¶ added in v2.2.0
func (c *GrpcClient) DescribeIndex(ctx context.Context, collName string, fieldName string, opts ...IndexOption) ([]entity.Index, error)
DescribeIndex describe index Deprecate please use DescribeIndexV2 instead.
func (*GrpcClient) DescribeResourceGroup ¶ added in v2.2.1
func (c *GrpcClient) DescribeResourceGroup(ctx context.Context, rgName string) (*entity.ResourceGroup, error)
DescribeResourceGroup returns resource groups information.
func (*GrpcClient) DropAlias ¶ added in v2.2.0
func (c *GrpcClient) DropAlias(ctx context.Context, alias string) error
DropAlias drops the specified Alias
func (*GrpcClient) DropCollection ¶ added in v2.2.0
func (c *GrpcClient) DropCollection(ctx context.Context, collName string) error
DropCollection drop collection by name
func (*GrpcClient) DropIndex ¶ added in v2.2.0
func (c *GrpcClient) DropIndex(ctx context.Context, collName string, fieldName string, opts ...IndexOption) error
DropIndex drop index from collection Deprecate please use DropIndexV2 instead.
func (*GrpcClient) DropPartition ¶ added in v2.2.0
func (c *GrpcClient) DropPartition(ctx context.Context, collName string, partitionName string) error
DropPartition drop partition from collection
func (*GrpcClient) DropResourceGroup ¶ added in v2.2.1
func (c *GrpcClient) DropResourceGroup(ctx context.Context, rgName string) error
DropResourceGroup drops the resource group with provided name.
func (*GrpcClient) DropRole ¶ added in v2.2.0
func (c *GrpcClient) DropRole(ctx context.Context, name string) error
DropRole drops a role entity in Milvus.
func (*GrpcClient) Flush ¶ added in v2.2.0
Flush force collection to flush memory records into storage in sync mode, flush will wait all segments to be flushed
func (*GrpcClient) GetBulkInsertState ¶ added in v2.2.0
func (c *GrpcClient) GetBulkInsertState(ctx context.Context, taskID int64) (*entity.BulkInsertTaskState, error)
GetBulkInsertState checks import task state
func (*GrpcClient) GetCollectionStatistics ¶ added in v2.2.0
func (c *GrpcClient) GetCollectionStatistics(ctx context.Context, collName string) (map[string]string, error)
GetCollectionStatistcis show collection statistics
func (*GrpcClient) GetCompactionState ¶ added in v2.2.0
func (c *GrpcClient) GetCompactionState(ctx context.Context, id int64) (entity.CompactionState, error)
GetCompactionState get compaction state of provided compaction id
func (*GrpcClient) GetCompactionStateWithPlans ¶ added in v2.2.0
func (c *GrpcClient) GetCompactionStateWithPlans(ctx context.Context, id int64) (entity.CompactionState, []entity.CompactionPlan, error)
GetCompactionStateWithPlans get compaction state with plans of provided compaction id
func (*GrpcClient) GetIndexBuildProgress ¶ added in v2.2.0
func (c *GrpcClient) GetIndexBuildProgress(ctx context.Context, collName string, fieldName string, opts ...IndexOption) (total, indexed int64, err error)
GetIndexBuildProgress get index building progress Deprecate please use DescribeIndexV2 instead.
func (*GrpcClient) GetIndexState ¶ added in v2.2.0
func (c *GrpcClient) GetIndexState(ctx context.Context, collName string, fieldName string, opts ...IndexOption) (entity.IndexState, error)
GetIndexState get index state Deprecate please use DescribeIndexV2 instead.
func (*GrpcClient) GetLoadState ¶ added in v2.2.1
func (c *GrpcClient) GetLoadState(ctx context.Context, collName string, partitionNames []string) (entity.LoadState, error)
GetLoadState get the collection or partitions load state
func (*GrpcClient) GetLoadingProgress ¶ added in v2.2.1
func (c *GrpcClient) GetLoadingProgress(ctx context.Context, collName string, partitionNames []string) (int64, error)
GetLoadingProgress get the collection or partitions loading progress
func (*GrpcClient) GetPersistentSegmentInfo ¶ added in v2.2.0
func (c *GrpcClient) GetPersistentSegmentInfo(ctx context.Context, collName string) ([]*entity.Segment, error)
GetPersistentSegmentInfo get persistent segment info
func (*GrpcClient) GetQuerySegmentInfo ¶ added in v2.2.0
func (c *GrpcClient) GetQuerySegmentInfo(ctx context.Context, collName string) ([]*entity.Segment, error)
GetQuerySegmentInfo get query query cluster segment loaded info
func (*GrpcClient) GetReplicas ¶ added in v2.2.0
func (c *GrpcClient) GetReplicas(ctx context.Context, collName string) ([]*entity.ReplicaGroup, error)
GetReplicas gets the replica groups as well as their querynodes and shards information
func (*GrpcClient) GetVersion ¶ added in v2.2.1
func (c *GrpcClient) GetVersion(ctx context.Context) (string, error)
func (*GrpcClient) Grant ¶ added in v2.2.0
func (c *GrpcClient) Grant(ctx context.Context, role string, objectType entity.PriviledgeObjectType, object string) error
Grant adds object privileged for role.
func (*GrpcClient) HasCollection ¶ added in v2.2.0
HasCollection check whether collection name exists
func (*GrpcClient) HasPartition ¶ added in v2.2.0
func (c *GrpcClient) HasPartition(ctx context.Context, collName string, partitionName string) (bool, error)
HasPartition check whether specified partition exists
func (*GrpcClient) Insert ¶ added in v2.2.0
func (c *GrpcClient) Insert(ctx context.Context, collName string, partitionName string, columns ...entity.Column) (entity.Column, error)
Insert Index into collection with column-based format collName is the collection name partitionName is the partition to insert, if not specified(empty), default partition will be used columns are slice of the column-based data
func (*GrpcClient) InsertByRows ¶ added in v2.2.0
func (c *GrpcClient) InsertByRows(ctx context.Context, collName string, partitionName string, rows []entity.Row) (entity.Column, error)
InsertByRows insert by rows
func (*GrpcClient) ListBulkInsertTasks ¶ added in v2.2.0
func (c *GrpcClient) ListBulkInsertTasks(ctx context.Context, collName string, limit int64) ([]*entity.BulkInsertTaskState, error)
ListBulkInsertTasks list state of all import tasks
func (*GrpcClient) ListCollections ¶ added in v2.2.0
func (c *GrpcClient) ListCollections(ctx context.Context) ([]*entity.Collection, error)
ListCollections list collections from connection Note that schema info are not provided in collection list
func (*GrpcClient) ListCredUsers ¶ added in v2.2.0
func (c *GrpcClient) ListCredUsers(ctx context.Context) ([]string, error)
ListCredUsers list all usernames
func (*GrpcClient) ListResourceGroups ¶ added in v2.2.1
func (c *GrpcClient) ListResourceGroups(ctx context.Context) ([]string, error)
ListResourceGroups returns list of resource group names in current Milvus instance.
func (*GrpcClient) LoadCollection ¶ added in v2.2.0
func (c *GrpcClient) LoadCollection(ctx context.Context, collName string, async bool, opts ...LoadCollectionOption) error
LoadCollection load collection into memory
func (*GrpcClient) LoadPartitions ¶ added in v2.2.0
func (c *GrpcClient) LoadPartitions(ctx context.Context, collName string, partitionNames []string, async bool) error
LoadPartitions load collection paritions into memory
func (*GrpcClient) ManualCompaction ¶ added in v2.2.0
func (c *GrpcClient) ManualCompaction(ctx context.Context, collName string, toleranceDuration time.Duration) (int64, error)
ManualCompaction triggers a compaction on provided collection
func (*GrpcClient) Query ¶ added in v2.2.0
func (c *GrpcClient) Query(ctx context.Context, collectionName string, partitionNames []string, expr string, outputFields []string, opts ...SearchQueryOptionFunc) ([]entity.Column, error)
Query performs query by expression.
func (*GrpcClient) QueryByPks ¶ added in v2.2.0
func (c *GrpcClient) QueryByPks(ctx context.Context, collectionName string, partitionNames []string, ids entity.Column, outputFields []string, opts ...SearchQueryOptionFunc) ([]entity.Column, error)
QueryByPks query record by specified primary key(s)
func (*GrpcClient) ReleaseCollection ¶ added in v2.2.0
func (c *GrpcClient) ReleaseCollection(ctx context.Context, collName string) error
ReleaseCollection release loaded collection
func (*GrpcClient) ReleasePartitions ¶ added in v2.2.0
func (c *GrpcClient) ReleasePartitions(ctx context.Context, collName string, partitionNames []string) error
ReleasePartitions release partitions
func (*GrpcClient) RemoveUserRole ¶ added in v2.2.0
RemoveUserRole removes one role from user.
func (*GrpcClient) Revoke ¶ added in v2.2.0
func (c *GrpcClient) Revoke(ctx context.Context, role string, objectType entity.PriviledgeObjectType, object string) error
Revoke removes privilege from role.
func (*GrpcClient) Search ¶ added in v2.2.0
func (c *GrpcClient) Search(ctx context.Context, collName string, partitions []string, expr string, outputFields []string, vectors []entity.Vector, vectorField string, metricType entity.MetricType, topK int, sp entity.SearchParam, opts ...SearchQueryOptionFunc) ([]SearchResult, error)
Search with bool expression
func (*GrpcClient) ShowCollection ¶ added in v2.2.0
func (c *GrpcClient) ShowCollection(ctx context.Context, collName string) (*entity.Collection, error)
ShowCollection show collection status, used to check whether it is loaded or not
func (*GrpcClient) ShowPartitions ¶ added in v2.2.0
func (c *GrpcClient) ShowPartitions(ctx context.Context, collName string) ([]*entity.Partition, error)
ShowPartitions list all partitions from collection
func (*GrpcClient) TransferNode ¶ added in v2.2.1
func (c *GrpcClient) TransferNode(ctx context.Context, sourceRg, targetRg string, nodesNum int32) error
TransferNode transfers querynodes between resource groups.
func (*GrpcClient) TransferReplica ¶ added in v2.2.1
func (c *GrpcClient) TransferReplica(ctx context.Context, sourceRg, targetRg string, collectionName string, replicaNum int64) error
TransferReplica transfer collection replicas between source,target resource group.
func (*GrpcClient) UpdateCredential ¶ added in v2.2.0
func (c *GrpcClient) UpdateCredential(ctx context.Context, username string, oldPassword string, newPassword string) error
UpdateCredential update password for a user
type IndexOption ¶ added in v2.2.0
type IndexOption func(*indexDef)
IndexOption is the predefined function to alter index def. shared among create, describe, drop indexes operations.
func WithIndexName ¶ added in v2.2.0
func WithIndexName(name string) IndexOption
WithIndexName returns an IndexOption with customized index name.
type LoadCollectionOption ¶ added in v2.1.0
type LoadCollectionOption func(*server.LoadCollectionRequest)
LoadCollectionOption is an option that is used to modify LoadCollectionRequest
func WithReplicaNumber ¶ added in v2.1.0
func WithReplicaNumber(rn int32) LoadCollectionOption
WithReplicaNumber specifies a specific ReplicaNumber, rather than using the default ReplicaNumber.
func WithResourceGroups ¶ added in v2.2.2
func WithResourceGroups(rgs []string) LoadCollectionOption
WithResourceGroups specifies some specific ResourceGroup(s) to load the replica(s), rather than using the default ResourceGroup.
type SearchQueryOption ¶ added in v2.1.0
type SearchQueryOption struct { // Consistency Level & Time travel ConsistencyLevel entity.ConsistencyLevel GuaranteeTimestamp uint64 TravelTimestamp uint64 // Pagination Limit int64 Offset int64 IgnoreGrowing bool }
SearchQueryOption is an option of search/query request
type SearchQueryOptionFunc ¶ added in v2.1.0
type SearchQueryOptionFunc func(option *SearchQueryOption)
SearchQueryOptionFunc is a function which modifies SearchOption
func WithGuaranteeTimestamp ¶ added in v2.1.0
func WithGuaranteeTimestamp(gt uint64) SearchQueryOptionFunc
WithGuaranteeTimestamp specifies guarantee timestamp
func WithIgnoreGrowing ¶ added in v2.2.2
func WithIgnoreGrowing() SearchQueryOptionFunc
func WithLimit ¶ added in v2.2.0
func WithLimit(limit int64) SearchQueryOptionFunc
WithLimit returns search/query option with limit.
func WithOffset ¶ added in v2.2.0
func WithOffset(offset int64) SearchQueryOptionFunc
WithOffset returns search/query option with offset.
func WithSearchQueryConsistencyLevel ¶ added in v2.1.0
func WithSearchQueryConsistencyLevel(cl entity.ConsistencyLevel) SearchQueryOptionFunc
WithSearchQueryConsistencyLevel specifies consistency level
func WithTravelTimestamp ¶ added in v2.1.0
func WithTravelTimestamp(tt uint64) SearchQueryOptionFunc
WithTravelTimestamp specifies time travel timestamp
type SearchResult ¶
type SearchResult struct { ResultCount int // the returning entry count IDs entity.Column // auto generated id, can be mapped to the columns from `Insert` API Fields []entity.Column // output field data Scores []float32 // distance to the target vector Err error // search error if any }
SearchResult contains the result from Search api of client IDs is the auto generated id values for the entities Fields contains the data of `outputFieleds` specified or all columns if non Scores is actually the distance between the vector current record contains and the search target vector
type SearchResultByRows ¶
SearchResultByRows search result for row-based Search
func SearchResultToRows ¶
func SearchResultToRows(sch *entity.Schema, results *schema.SearchResultData, t reflect.Type, output map[string]struct{}) ([]SearchResultByRows, error)
SearchResultToRows converts search result proto to rows
Source Files ¶
- client.go
- client_grpc_admin.go
- client_grpc_alias.go
- client_grpc_authentication.go
- client_grpc_collection.go
- client_grpc_control.go
- client_grpc_data.go
- client_grpc_index.go
- client_grpc_options.go
- client_grpc_partition.go
- client_grpc_rbac.go
- client_grpc_rg.go
- client_grpc_row.go
- ctx.go
- errors.go
- interceptor.go
- meta_cache.go
- rate_limit_interceptor.go