Documentation ¶
Overview ¶
Package client provides milvus client functions
Index ¶
- Constants
- Variables
- func NewRRFReranker() *rrfReranker
- func NewWeightedReranker(weights []float64) *weightedReranker
- func PKs2Expr(backName string, ids entity.Column) string
- func RetryOnRateLimitInterceptor(maxRetry uint, maxBackoff time.Duration, ...) grpc.UnaryClientInterceptor
- func SetFieldValue(field *entity.Field, f reflect.Value, fieldData *schemapb.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 ANNSearchRequest
- type BulkInsertOption
- type Client
- func NewClient(ctx context.Context, config Config) (Client, error)
- 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 Config
- type CreateCollectionOption
- func WithAutoID(autoID bool) CreateCollectionOption
- func WithCollectionProperty(key, value string) CreateCollectionOption
- func WithConsistencyLevel(cl entity.ConsistencyLevel) CreateCollectionOption
- func WithCreateCollectionMsgBase(msgBase *commonpb.MsgBase) CreateCollectionOption
- func WithEnableDynamicSchema(enable bool) CreateCollectionOption
- func WithMetricsType(mt entity.MetricType) CreateCollectionOption
- func WithPKFieldName(name string) CreateCollectionOption
- func WithPKFieldType(tp entity.FieldType) CreateCollectionOption
- func WithPKMaxLength(maxLength int64) CreateCollectionOption
- func WithPartitionNum(partitionNums int64) CreateCollectionOption
- func WithVectorFieldName(name string) CreateCollectionOption
- type CreateDatabaseOption
- type CreatePartitionOption
- type CreateResourceGroupOption
- type DescribeDatabaseOption
- type DropCollectionOption
- type DropDatabaseOption
- type DropPartitionOption
- type ErrCollectionNotExists
- type ErrPartitionNotExists
- type ErrServiceFailed
- type FlushOption
- type GetOption
- 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) AlterDatabase(ctx context.Context, dbName string, attrs ...entity.DatabaseAttribute) error
- func (c *GrpcClient) AlterIndex(ctx context.Context, collName string, indexName string, opts ...IndexOption) error
- func (c *GrpcClient) BackupRBAC(ctx context.Context) (*entity.RBACMeta, 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) CheckHealth(ctx context.Context) (*entity.MilvusState, 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) CreateDatabase(ctx context.Context, dbName string, opts ...CreateDatabaseOption) 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, opts ...CreateResourceGroupOption) error
- func (c *GrpcClient) CreateRole(ctx context.Context, name string) error
- func (c *GrpcClient) Delete(ctx context.Context, collName string, partitionName string, expr 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) DescribeDatabase(ctx context.Context, dbName string) (*entity.Database, 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) DescribeUser(ctx context.Context, username string) (entity.UserDescription, error)
- func (c *GrpcClient) DescribeUsers(ctx context.Context) ([]entity.UserDescription, error)
- func (c *GrpcClient) DropAlias(ctx context.Context, alias string) error
- func (c *GrpcClient) DropCollection(ctx context.Context, collName string, opts ...DropCollectionOption) error
- func (c *GrpcClient) DropDatabase(ctx context.Context, dbName string, opts ...DropDatabaseOption) 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, opts ...FlushOption) error
- func (c *GrpcClient) FlushV2(ctx context.Context, collName string, async bool, opts ...FlushOption) ([]int64, []int64, int64, map[string]msgpb.MsgPosition, error)
- func (c *GrpcClient) Get(ctx context.Context, collectionName string, ids entity.Column, ...) (ResultSet, 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) HybridSearch(ctx context.Context, collName string, partitions []string, limit int, ...) ([]SearchResult, 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) InsertRows(ctx context.Context, collName string, partitionName string, rows []interface{}) (entity.Column, error)
- func (c *GrpcClient) ListBulkInsertTasks(ctx context.Context, collName string, limit int64) ([]*entity.BulkInsertTaskState, error)
- func (c *GrpcClient) ListCollections(ctx context.Context, opts ...ListCollectionOption) ([]*entity.Collection, error)
- func (c *GrpcClient) ListCredUsers(ctx context.Context) ([]string, error)
- func (c *GrpcClient) ListDatabases(ctx context.Context) ([]entity.Database, error)
- func (c *GrpcClient) ListGrant(ctx context.Context, role string, object string, objectName string, ...) ([]entity.RoleGrants, error)
- func (c *GrpcClient) ListGrants(ctx context.Context, role string, dbName string) ([]entity.RoleGrants, 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, _ time.Duration) (int64, error)
- func (c *GrpcClient) NewCollection(ctx context.Context, collName string, dimension int64, ...) error
- func (c *GrpcClient) Query(ctx context.Context, collectionName string, partitionNames []string, ...) (ResultSet, error)
- func (c *GrpcClient) QueryByPks(ctx context.Context, collectionName string, partitionNames []string, ...) (ResultSet, error)
- func (c *GrpcClient) QueryIterator(ctx context.Context, opt *QueryIteratorOption) (*QueryIterator, error)
- func (c *GrpcClient) ReleaseCollection(ctx context.Context, collName string, opts ...ReleaseCollectionOption) 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) RenameCollection(ctx context.Context, collName, newName string) error
- func (c *GrpcClient) ReplicateMessage(ctx context.Context, channelName string, beginTs, endTs uint64, ...) (*entity.MessageInfo, error)
- func (c *GrpcClient) RestoreRBAC(ctx context.Context, meta *entity.RBACMeta) 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) SearchIterator(ctx context.Context, opt *SearchIteratorOption) (*SearchIterator, 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
- func (c *GrpcClient) UpdateResourceGroups(ctx context.Context, opts ...UpdateResourceGroupsOption) error
- func (c *GrpcClient) Upsert(ctx context.Context, collName string, partitionName string, ...) (entity.Column, error)
- func (c *GrpcClient) UsingDatabase(ctx context.Context, dbName string) error
- type IndexOption
- type ListCollectionOption
- type LoadCollectionOption
- func WithLoadCollectionMsgBase(msgBase *commonpb.MsgBase) LoadCollectionOption
- func WithLoadFields(fields ...string) LoadCollectionOption
- func WithReplicaNumber(rn int32) LoadCollectionOption
- func WithResourceGroups(rgs []string) LoadCollectionOption
- func WithSkipDynamicFields(skip bool) LoadCollectionOption
- type LoadPartitionsOption
- type QueryIterator
- type QueryIteratorOption
- func (opt *QueryIteratorOption) WithBatchSize(batchSize int) *QueryIteratorOption
- func (opt *QueryIteratorOption) WithExpr(expr string) *QueryIteratorOption
- func (opt *QueryIteratorOption) WithOutputFields(outputFields ...string) *QueryIteratorOption
- func (opt *QueryIteratorOption) WithPartitions(partitionNames ...string) *QueryIteratorOption
- type ReleaseCollectionOption
- type ReleasePartitionsOption
- type ReplicateMessageOption
- type Reranker
- type ResultSet
- type RetryRateLimitOption
- type SearchIterator
- type SearchIteratorOption
- func (opt *SearchIteratorOption) WithBatchSize(batchSize int) *SearchIteratorOption
- func (opt *SearchIteratorOption) WithExpr(expr string) *SearchIteratorOption
- func (opt *SearchIteratorOption) WithOutputFields(outputFields ...string) *SearchIteratorOption
- func (opt *SearchIteratorOption) WithPartitions(partitionNames ...string) *SearchIteratorOption
- type SearchQueryOption
- type SearchQueryOptionFunc
- func WithForTuning() SearchQueryOptionFunc
- func WithGroupByField(groupByField string) 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(_ uint64) SearchQueryOptionFuncdeprecated
- type SearchResult
- type SearchResultByRows
- type UpdateResourceGroupsOption
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") // ErrFeatureNotSupported error indicates current server does not support this feature ErrFeatureNotSupported = errors.New("feature not supported") )
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, }), grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32), ), }
DefaultGrpcOpts is GRPC options for milvus client.
var ErrFieldTypeNotMatch = errors.New("field type not matched")
ErrFieldTypeNotMatch error for field type not match
Functions ¶
func NewRRFReranker ¶ added in v2.4.0
func NewRRFReranker() *rrfReranker
func NewWeightedReranker ¶ added in v2.4.0
func NewWeightedReranker(weights []float64) *weightedReranker
func RetryOnRateLimitInterceptor ¶ added in v2.2.0
func RetryOnRateLimitInterceptor(maxRetry uint, maxBackoff time.Duration, 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 *schemapb.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 ANNSearchRequest ¶ added in v2.4.0
type ANNSearchRequest struct {
// contains filtered or unexported fields
}
func NewANNSearchRequest ¶ added in v2.4.0
func NewANNSearchRequest(fieldName string, metricsType entity.MetricType, expr string, vectors []entity.Vector, searchParam entity.SearchParam, limit int, options ...SearchQueryOptionFunc) *ANNSearchRequest
func (*ANNSearchRequest) WithExpr ¶ added in v2.4.0
func (r *ANNSearchRequest) WithExpr(expr string) *ANNSearchRequest
type BulkInsertOption ¶ added in v2.2.0
type BulkInsertOption func(request *milvuspb.ImportRequest)
BulkInsertOption is an option that is used to modify ImportRequest
func IsBackup ¶ added in v2.2.3
func IsBackup() BulkInsertOption
IsBackup specifies it is triggered by backup tool
func IsL0 ¶ added in v2.4.2
func IsL0(isL0 bool) BulkInsertOption
IsL0 specifies it is to import L0 segment binlog
func SkipDiskQuotaCheck ¶ added in v2.4.2
func SkipDiskQuotaCheck(skipDiskQuotaCheck bool) BulkInsertOption
SkipDiskQuotaCheck https://github.com/milvus-io/milvus/pull/35274
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 { // -- client -- // Close close the remaining connection resources Close() error // UsingDatabase for database operation after this function call. // All request in any goroutine will be applied to new database on the same client. e.g. // 1. goroutine A access DB1. // 2. goroutine B call UsingDatabase(ctx, "DB2"). // 3. goroutine A access DB2 after 2. UsingDatabase(ctx context.Context, dbName string) error // -- database -- // ListDatabases list all database in milvus cluster. ListDatabases(ctx context.Context) ([]entity.Database, error) // CreateDatabase create database with the given name. CreateDatabase(ctx context.Context, dbName string, opts ...CreateDatabaseOption) error // DropDatabase drop database with the given db name. DropDatabase(ctx context.Context, dbName string, opts ...DropDatabaseOption) error // AlterDatabase alter database props with given db name. AlterDatabase(ctx context.Context, dbName string, attrs ...entity.DatabaseAttribute) error DescribeDatabase(ctx context.Context, dbName string) (*entity.Database, error) // NewCollection intializeds a new collection with pre defined attributes NewCollection(ctx context.Context, collName string, dimension int64, opts ...CreateCollectionOption) error // ListCollections list collections from connection ListCollections(ctx context.Context, opts ...ListCollectionOption) ([]*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, opts ...DropCollectionOption) 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, opts ...ReleaseCollectionOption) error // HasCollection check whether collection exists HasCollection(ctx context.Context, collName string) (bool, error) // RenameCollection performs renaming for provided collection. RenameCollection(ctx context.Context, collName, newName string) error // AlterCollection changes collection attributes. 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) // BackupRBAC back up rbac meta info, include user/role/grants BackupRBAC(ctx context.Context) (*entity.RBACMeta, error) RestoreRBAC(ctx context.Context, meta *entity.RBACMeta) 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, opts ...CreatePartitionOption) error // DropPartition drop partition from collection DropPartition(ctx context.Context, collName string, partitionName string, opts ...DropPartitionOption) 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, opts ...LoadPartitionsOption) error // ReleasePartitions release partitions ReleasePartitions(ctx context.Context, collName string, partitionNames []string, opts ...ReleasePartitionsOption) 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) // AlterIndex modifies the index params. AlterIndex(ctx context.Context, collName, indexName string, opts ...IndexOption) error // GetIndexBuildProgress get index building progress GetIndexBuildProgress(ctx context.Context, collName string, fieldName string, opts ...IndexOption) (total, indexed int64, err 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 collection, specified Flush(ctx context.Context, collName string, async bool, opts ...FlushOption) error // FlushV2 flush collection, specified, return newly sealed segmentIds, all flushed segmentIds of the collection, seal time and error // currently it is only used in milvus-backup(https://github.com/zilliztech/milvus-backup) FlushV2(ctx context.Context, collName string, async bool, opts ...FlushOption) ([]int64, []int64, int64, map[string]msgpb.MsgPosition, error) // DeleteByPks deletes entries related to provided primary keys DeleteByPks(ctx context.Context, collName string, partitionName string, ids entity.Column) error // Delete deletes entries match expression Delete(ctx context.Context, collName string, partitionName string, expr string) error // Upsert column-based data of collection, returns id column values Upsert(ctx context.Context, collName string, partitionName string, columns ...entity.Column) (entity.Column, error) // 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) (ResultSet, error) // Query performs query records with boolean expression. Query(ctx context.Context, collectionName string, partitionNames []string, expr string, outputFields []string, opts ...SearchQueryOptionFunc) (ResultSet, error) // Get grabs the inserted entities using the primary key from the Collection. Get(ctx context.Context, collectionName string, ids entity.Column, opts ...GetOption) (ResultSet, error) // TODO @silverxia current imlementation is buggy and cannot be released // hide interface until fixed // SearchIterator returns knn result in iterator mode. // SearchIterator(ctx context.Context, opt *SearchIteratorOption) (*SearchIterator, error) // QueryIterator returns data matches provided criterion in iterator mode. QueryIterator(ctx context.Context, opt *QueryIteratorOption) (*QueryIterator, 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 // DEPRECATED // InsertByRows insert by rows InsertByRows(ctx context.Context, collName string, paritionName string, rows []entity.Row) (entity.Column, error) // InsertRows insert with row base data. InsertRows(ctx context.Context, collName string, partitionName string, rows []interface{}) (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) // DescribeUser describes specific user attributes in the system DescribeUser(ctx context.Context, username string) (entity.UserDescription, error) // DescribeUsers describe all users attributes in the system DescribeUsers(ctx context.Context) ([]entity.UserDescription, error) // ListGrant lists a grant info for the role and the specific object ListGrant(ctx context.Context, role string, object string, objectName string, dbName string) ([]entity.RoleGrants, error) // ListGrants lists all assigned privileges and objects for the role. ListGrants(ctx context.Context, role string, dbName string) ([]entity.RoleGrants, error) // Grant adds privilege for role. Grant(ctx context.Context, role string, objectType entity.PriviledgeObjectType, object string, privilege string, options ...entity.OperatePrivilegeOption) error // Revoke removes privilege from role. Revoke(ctx context.Context, role string, objectType entity.PriviledgeObjectType, object string, privilege string, options ...entity.OperatePrivilegeOption) 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, opts ...CreateResourceGroupOption) error // UpdateResourceGroups updates resource groups with provided options. UpdateResourceGroups(ctx context.Context, opts ...UpdateResourceGroupsOption) 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) // CheckHealth returns milvus state CheckHealth(ctx context.Context) (*entity.MilvusState, error) ReplicateMessage(ctx context.Context, channelName string, beginTs, endTs uint64, msgsBytes [][]byte, startPositions, endPositions []*msgpb.MsgPosition, opts ...ReplicateMessageOption, ) (*entity.MessageInfo, error) HybridSearch(ctx context.Context, collName string, partitions []string, limit int, outputFields []string, reranker Reranker, subRequests []*ANNSearchRequest, opts ...SearchQueryOptionFunc) ([]SearchResult, error) }
Client is the interface used to communicate with Milvus
func NewClient ¶ added in v2.2.3
NewClient create a client connected to remote milvus cluster. More connect option can be modified by Config.
func NewDefaultGrpcClient ¶ added in v2.1.2
NewDefaultGrpcClient creates a new gRPC client. !!!Deprecated in future, use `NewClient` first.
func NewDefaultGrpcClientWithAuth ¶ added in v2.1.2
func NewDefaultGrpcClientWithAuth(ctx context.Context, addr, username, password string) (Client, error)
NewDefaultGrpcClientWithAuth creates a new gRPC client with authentication. !!!Deprecated in future, use `NewClient` first.
func NewDefaultGrpcClientWithTLSAuth ¶ added in v2.1.2
func NewDefaultGrpcClientWithTLSAuth(ctx context.Context, addr, username, password string) (Client, error)
NewDefaultGrpcClientWithTLSAuth creates a new gRPC client with TLS authentication. !!!Deprecated in future, use `NewClient` first.
func NewDefaultGrpcClientWithURI ¶ added in v2.2.0
func NewDefaultGrpcClientWithURI(ctx context.Context, uri, username, password string) (Client, error)
NewDefaultGrpcClientWithURI creates a new gRPC client with URI. !!!Deprecated in future, use `NewClient` first.
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 !!!Deprecated in future, use `NewClient` first.
type Config ¶ added in v2.2.3
type Config struct { Address string // Remote address, "localhost:19530". Username string // Username for auth. Password string // Password for auth. DBName string // DBName for this client. Identifier string // Identifier for this connection EnableTLSAuth bool // Enable TLS Auth for transport security. APIKey string // API key ServerVersion string // ServerVersion DialOptions []grpc.DialOption // Dial options for GRPC. RetryRateLimit *RetryRateLimitOption // option for retry on rate limit inteceptor DisableConn bool // contains filtered or unexported fields }
Config for milvus client.
type CreateCollectionOption ¶ added in v2.1.0
type CreateCollectionOption func(opt *createCollOpt)
CreateCollectionOption is an option that is used to alter create collection options.
func WithAutoID ¶ added in v2.2.5
func WithAutoID(autoID bool) CreateCollectionOption
func WithCollectionProperty ¶ added in v2.2.6
func WithCollectionProperty(key, value string) CreateCollectionOption
func WithConsistencyLevel ¶ added in v2.1.0
func WithConsistencyLevel(cl entity.ConsistencyLevel) CreateCollectionOption
WithConsistencyLevel specifies a specific ConsistencyLevel, rather than using the default ReaderProperties.
func WithCreateCollectionMsgBase ¶ added in v2.3.3
func WithCreateCollectionMsgBase(msgBase *commonpb.MsgBase) CreateCollectionOption
func WithEnableDynamicSchema ¶ added in v2.2.5
func WithEnableDynamicSchema(enable bool) CreateCollectionOption
func WithMetricsType ¶ added in v2.2.5
func WithMetricsType(mt entity.MetricType) CreateCollectionOption
func WithPKFieldName ¶ added in v2.2.5
func WithPKFieldName(name string) CreateCollectionOption
func WithPKFieldType ¶ added in v2.2.5
func WithPKFieldType(tp entity.FieldType) CreateCollectionOption
func WithPKMaxLength ¶ added in v2.2.5
func WithPKMaxLength(maxLength int64) CreateCollectionOption
func WithPartitionNum ¶ added in v2.2.3
func WithPartitionNum(partitionNums int64) CreateCollectionOption
WithPartitionNum returns a create collection options to set physical partition number when logical partition feature.
func WithVectorFieldName ¶ added in v2.2.5
func WithVectorFieldName(name string) CreateCollectionOption
type CreateDatabaseOption ¶ added in v2.3.3
type CreateDatabaseOption func(*createDatabaseOpt)
func WithCreateDatabaseMsgBase ¶ added in v2.3.3
func WithCreateDatabaseMsgBase(msgBase *commonpb.MsgBase) CreateDatabaseOption
func WithDatabaseProperty ¶ added in v2.4.2
func WithDatabaseProperty(key, value string) CreateDatabaseOption
type CreatePartitionOption ¶ added in v2.3.3
type CreatePartitionOption func(*milvuspb.CreatePartitionRequest)
func WithCreatePartitionMsgBase ¶ added in v2.3.3
func WithCreatePartitionMsgBase(msgBase *commonpb.MsgBase) CreatePartitionOption
type CreateResourceGroupOption ¶ added in v2.4.2
type CreateResourceGroupOption func(*milvuspb.CreateResourceGroupRequest)
CreateResourceGroupOption is an option that is used in CreateResourceGroup API.
func WithCreateResourceGroupConfig ¶ added in v2.4.2
func WithCreateResourceGroupConfig(config *entity.ResourceGroupConfig) CreateResourceGroupOption
WithCreateResourceGroupConfig returns a CreateResourceGroupOption that setup the config.
type DescribeDatabaseOption ¶ added in v2.4.1
type DescribeDatabaseOption func(*milvuspb.DescribeDatabaseRequest)
type DropCollectionOption ¶ added in v2.3.3
type DropCollectionOption func(*milvuspb.DropCollectionRequest)
func WithDropCollectionMsgBase ¶ added in v2.3.3
func WithDropCollectionMsgBase(msgBase *commonpb.MsgBase) DropCollectionOption
type DropDatabaseOption ¶ added in v2.3.3
type DropDatabaseOption func(*milvuspb.DropDatabaseRequest)
func WithDropDatabaseMsgBase ¶ added in v2.3.3
func WithDropDatabaseMsgBase(msgBase *commonpb.MsgBase) DropDatabaseOption
type DropPartitionOption ¶ added in v2.3.3
type DropPartitionOption func(*milvuspb.DropPartitionRequest)
func WithDropPartitionMsgBase ¶ added in v2.3.3
func WithDropPartitionMsgBase(msgBase *commonpb.MsgBase) DropPartitionOption
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 FlushOption ¶ added in v2.3.3
type FlushOption func(*milvuspb.FlushRequest)
func WithFlushMsgBase ¶ added in v2.3.3
func WithFlushMsgBase(msgBase *commonpb.MsgBase) FlushOption
type GetOption ¶ added in v2.2.5
type GetOption func(o *getOption)
func GetWithOutputFields ¶ added in v2.2.5
func GetWithPartitions ¶ added in v2.2.5
type GrpcClient ¶ added in v2.2.0
type GrpcClient struct { Conn *grpc.ClientConn // grpc connection instance Service milvuspb.MilvusServiceClient // Service client stub // contains filtered or unexported fields }
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) AlterDatabase ¶ added in v2.4.1
func (c *GrpcClient) AlterDatabase(ctx context.Context, dbName string, attrs ...entity.DatabaseAttribute) error
AlterDatabase changes the database attribute.
func (*GrpcClient) AlterIndex ¶ added in v2.4.0
func (c *GrpcClient) AlterIndex(ctx context.Context, collName string, indexName string, opts ...IndexOption) error
AlterIndex modifies the index params
func (*GrpcClient) BackupRBAC ¶ added in v2.4.2
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) CheckHealth ¶ added in v2.3.2
func (c *GrpcClient) CheckHealth(ctx context.Context) (*entity.MilvusState, error)
CheckHealth returns milvus state
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) CreateDatabase ¶ added in v2.2.3
func (c *GrpcClient) CreateDatabase(ctx context.Context, dbName string, opts ...CreateDatabaseOption) error
CreateDatabase creates a new database for remote Milvus cluster. TODO:New options can be added as expanding parameters.
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, opts ...CreatePartitionOption) error
CreatePartition create partition for collection
func (*GrpcClient) CreateResourceGroup ¶ added in v2.2.1
func (c *GrpcClient) CreateResourceGroup(ctx context.Context, rgName string, opts ...CreateResourceGroupOption) 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) Delete ¶ added in v2.3.1
func (c *GrpcClient) Delete(ctx context.Context, collName string, partitionName string, expr string) error
Delete deletes entries match expression
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) DescribeDatabase ¶ added in v2.4.1
DropDatabase drop all database in milvus cluster.
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
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) DescribeUser ¶ added in v2.4.0
func (c *GrpcClient) DescribeUser(ctx context.Context, username string) (entity.UserDescription, error)
DescribeUser lists the user descriptions in the system (name, roles)
func (*GrpcClient) DescribeUsers ¶ added in v2.4.0
func (c *GrpcClient) DescribeUsers(ctx context.Context) ([]entity.UserDescription, error)
DescribeUsers lists all users with descriptions (names, roles)
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, opts ...DropCollectionOption) error
DropCollection drop collection by name
func (*GrpcClient) DropDatabase ¶ added in v2.2.3
func (c *GrpcClient) DropDatabase(ctx context.Context, dbName string, opts ...DropDatabaseOption) error
DropDatabase drop all database in milvus cluster.
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, opts ...DropPartitionOption) 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
func (c *GrpcClient) Flush(ctx context.Context, collName string, async bool, opts ...FlushOption) error
Flush force collection to flush memory records into storage in sync mode, flush will wait all segments to be flushed
func (*GrpcClient) FlushV2 ¶ added in v2.2.3
func (c *GrpcClient) FlushV2(ctx context.Context, collName string, async bool, opts ...FlushOption) ([]int64, []int64, int64, map[string]msgpb.MsgPosition, error)
Flush force collection to flush memory records into storage in sync mode, flush will wait all segments to be flushed
func (*GrpcClient) Get ¶ added in v2.2.5
func (c *GrpcClient) Get(ctx context.Context, collectionName string, ids entity.Column, opts ...GetOption) (ResultSet, error)
Get grabs the inserted entities using the primary key from the Collection.
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
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
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)
GetVersion returns milvus server version information.
func (*GrpcClient) Grant ¶ added in v2.2.0
func (c *GrpcClient) Grant(ctx context.Context, role string, objectType entity.PriviledgeObjectType, object string, privilege string, options ...entity.OperatePrivilegeOption) 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) HybridSearch ¶ added in v2.4.0
func (c *GrpcClient) HybridSearch(ctx context.Context, collName string, partitions []string, limit int, outputFields []string, reranker Reranker, subRequests []*ANNSearchRequest, opts ...SearchQueryOptionFunc) ([]SearchResult, error)
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) InsertRows ¶ added in v2.2.3
func (c *GrpcClient) InsertRows(ctx context.Context, collName string, partitionName string, rows []interface{}, ) (entity.Column, error)
InsertRows allows insert with row based data rows could be struct or map.
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, opts ...ListCollectionOption) ([]*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) ListDatabases ¶ added in v2.2.3
ListDatabases list all database in milvus cluster.
func (*GrpcClient) ListGrant ¶ added in v2.4.1
func (c *GrpcClient) ListGrant(ctx context.Context, role string, object string, objectName string, dbName string) ([]entity.RoleGrants, error)
ListGrant lists a grant info for the role and the specific object
func (*GrpcClient) ListGrants ¶ added in v2.4.1
func (c *GrpcClient) ListGrants(ctx context.Context, role string, dbName string) ([]entity.RoleGrants, error)
ListGrants lists the role grants in the system
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, opts ...LoadPartitionsOption) error
LoadPartitions load collection paritions into memory
func (*GrpcClient) ManualCompaction ¶ added in v2.2.0
func (c *GrpcClient) ManualCompaction(ctx context.Context, collName string, _ time.Duration) (int64, error)
ManualCompaction triggers a compaction on provided collection
func (*GrpcClient) NewCollection ¶ added in v2.2.5
func (c *GrpcClient) NewCollection(ctx context.Context, collName string, dimension int64, opts ...CreateCollectionOption) error
NewCollection creates a common simple collection with pre-defined attributes.
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) (ResultSet, 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) (ResultSet, error)
QueryByPks query record by specified primary key(s)
func (*GrpcClient) QueryIterator ¶ added in v2.4.1
func (c *GrpcClient) QueryIterator(ctx context.Context, opt *QueryIteratorOption) (*QueryIterator, error)
func (*GrpcClient) ReleaseCollection ¶ added in v2.2.0
func (c *GrpcClient) ReleaseCollection(ctx context.Context, collName string, opts ...ReleaseCollectionOption) error
ReleaseCollection release loaded collection
func (*GrpcClient) ReleasePartitions ¶ added in v2.2.0
func (c *GrpcClient) ReleasePartitions(ctx context.Context, collName string, partitionNames []string, opts ...ReleasePartitionsOption) error
ReleasePartitions release partitions
func (*GrpcClient) RemoveUserRole ¶ added in v2.2.0
RemoveUserRole removes one role from user.
func (*GrpcClient) RenameCollection ¶ added in v2.3.0
func (c *GrpcClient) RenameCollection(ctx context.Context, collName, newName string) error
RenameCollection performs renaming for provided collection.
func (*GrpcClient) ReplicateMessage ¶ added in v2.3.3
func (c *GrpcClient) ReplicateMessage(ctx context.Context, channelName string, beginTs, endTs uint64, msgsBytes [][]byte, startPositions, endPositions []*msgpb.MsgPosition, opts ...ReplicateMessageOption) (*entity.MessageInfo, error)
func (*GrpcClient) RestoreRBAC ¶ added in v2.4.2
func (*GrpcClient) Revoke ¶ added in v2.2.0
func (c *GrpcClient) Revoke(ctx context.Context, role string, objectType entity.PriviledgeObjectType, object string, privilege string, options ...entity.OperatePrivilegeOption) 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) SearchIterator ¶ added in v2.4.2
func (c *GrpcClient) SearchIterator(ctx context.Context, opt *SearchIteratorOption) (*SearchIterator, error)
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
func (*GrpcClient) UpdateResourceGroups ¶ added in v2.4.2
func (c *GrpcClient) UpdateResourceGroups(ctx context.Context, opts ...UpdateResourceGroupsOption) error
UpdateResourceGroups updates resource groups with provided options.
func (*GrpcClient) Upsert ¶ added in v2.3.0
func (c *GrpcClient) Upsert(ctx context.Context, collName string, partitionName string, columns ...entity.Column) (entity.Column, error)
Upsert Index into collection with column-based format collName is the collection name partitionName is the partition to upsert, if not specified(empty), default partition will be used columns are slice of the column-based data
func (*GrpcClient) UsingDatabase ¶ added in v2.2.3
func (c *GrpcClient) UsingDatabase(ctx context.Context, dbName string) error
UsingDatabase for database operation after this function call. All request in any goroutine will be applied to new database on the same client. e.g. 1. goroutine A access DB1. 2. goroutine B call UsingDatabase(ctx, "DB2"). 3. goroutine A access DB2 after 2.
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 WithIndexMsgBase ¶ added in v2.3.3
func WithIndexMsgBase(msgBase *commonpb.MsgBase) IndexOption
func WithIndexName ¶ added in v2.2.0
func WithIndexName(name string) IndexOption
WithIndexName returns an IndexOption with customized index name.
func WithMmap ¶ added in v2.4.0
func WithMmap(enabled bool) IndexOption
type ListCollectionOption ¶ added in v2.4.1
type ListCollectionOption func(*listCollectionOpt)
func WithShowInMemory ¶ added in v2.4.1
func WithShowInMemory(value bool) ListCollectionOption
type LoadCollectionOption ¶ added in v2.1.0
type LoadCollectionOption func(*milvuspb.LoadCollectionRequest)
LoadCollectionOption is an option that is used to modify LoadCollectionRequest
func WithLoadCollectionMsgBase ¶ added in v2.3.3
func WithLoadCollectionMsgBase(msgBase *commonpb.MsgBase) LoadCollectionOption
func WithLoadFields ¶ added in v2.4.2
func WithLoadFields(fields ...string) LoadCollectionOption
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.
func WithSkipDynamicFields ¶ added in v2.4.2
func WithSkipDynamicFields(skip bool) LoadCollectionOption
type LoadPartitionsOption ¶ added in v2.3.3
type LoadPartitionsOption func(*milvuspb.LoadPartitionsRequest)
func WithLoadPartitionsMsgBase ¶ added in v2.3.3
func WithLoadPartitionsMsgBase(msgBase *commonpb.MsgBase) LoadPartitionsOption
type QueryIterator ¶ added in v2.4.1
type QueryIterator struct {
// contains filtered or unexported fields
}
type QueryIteratorOption ¶ added in v2.4.1
type QueryIteratorOption struct {
// contains filtered or unexported fields
}
func NewQueryIteratorOption ¶ added in v2.4.1
func NewQueryIteratorOption(collectionName string) *QueryIteratorOption
func (*QueryIteratorOption) WithBatchSize ¶ added in v2.4.1
func (opt *QueryIteratorOption) WithBatchSize(batchSize int) *QueryIteratorOption
func (*QueryIteratorOption) WithExpr ¶ added in v2.4.1
func (opt *QueryIteratorOption) WithExpr(expr string) *QueryIteratorOption
func (*QueryIteratorOption) WithOutputFields ¶ added in v2.4.1
func (opt *QueryIteratorOption) WithOutputFields(outputFields ...string) *QueryIteratorOption
func (*QueryIteratorOption) WithPartitions ¶ added in v2.4.1
func (opt *QueryIteratorOption) WithPartitions(partitionNames ...string) *QueryIteratorOption
type ReleaseCollectionOption ¶ added in v2.3.3
type ReleaseCollectionOption func(*milvuspb.ReleaseCollectionRequest)
func WithReleaseCollectionMsgBase ¶ added in v2.3.3
func WithReleaseCollectionMsgBase(msgBase *commonpb.MsgBase) ReleaseCollectionOption
type ReleasePartitionsOption ¶ added in v2.3.3
type ReleasePartitionsOption func(*milvuspb.ReleasePartitionsRequest)
func WithReleasePartitionMsgBase
deprecated
added in
v2.3.3
func WithReleasePartitionMsgBase(msgBase *commonpb.MsgBase) ReleasePartitionsOption
Deprecated: use WithReleaseCollectionMsgBase instead
func WithReleasePartitionsMsgBase ¶ added in v2.3.4
func WithReleasePartitionsMsgBase(msgBase *commonpb.MsgBase) ReleasePartitionsOption
type ReplicateMessageOption ¶ added in v2.3.3
type ReplicateMessageOption func(*milvuspb.ReplicateMessageRequest)
func WithReplicateMessageMsgBase ¶ added in v2.3.3
func WithReplicateMessageMsgBase(msgBase *commonpb.MsgBase) ReplicateMessageOption
type Reranker ¶ added in v2.4.0
type Reranker interface {
GetParams() []*commonpb.KeyValuePair
}
type ResultSet ¶ added in v2.2.3
ResultSet is an alias type for column slice.
type RetryRateLimitOption ¶ added in v2.2.7
type SearchIterator ¶ added in v2.4.2
type SearchIterator struct {
// contains filtered or unexported fields
}
func (*SearchIterator) Next ¶ added in v2.4.2
func (itr *SearchIterator) Next(ctx context.Context) (*SearchResult, error)
type SearchIteratorOption ¶ added in v2.4.2
type SearchIteratorOption struct {
// contains filtered or unexported fields
}
func NewSearchIteratorOption ¶ added in v2.4.2
func NewSearchIteratorOption(collectionName string, vectorFieldName string, sp entity.SearchParam, vector entity.Vector, metricType entity.MetricType) *SearchIteratorOption
func (*SearchIteratorOption) WithBatchSize ¶ added in v2.4.2
func (opt *SearchIteratorOption) WithBatchSize(batchSize int) *SearchIteratorOption
func (*SearchIteratorOption) WithExpr ¶ added in v2.4.2
func (opt *SearchIteratorOption) WithExpr(expr string) *SearchIteratorOption
func (*SearchIteratorOption) WithOutputFields ¶ added in v2.4.2
func (opt *SearchIteratorOption) WithOutputFields(outputFields ...string) *SearchIteratorOption
func (*SearchIteratorOption) WithPartitions ¶ added in v2.4.2
func (opt *SearchIteratorOption) WithPartitions(partitionNames ...string) *SearchIteratorOption
type SearchQueryOption ¶ added in v2.1.0
type SearchQueryOption struct { // Consistency Level ConsistencyLevel entity.ConsistencyLevel GuaranteeTimestamp uint64 // Pagination Limit int64 Offset int64 IgnoreGrowing bool ForTuning bool GroupByField string // contains filtered or unexported fields }
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 WithForTuning ¶ added in v2.3.0
func WithForTuning() SearchQueryOptionFunc
func WithGroupByField ¶ added in v2.4.0
func WithGroupByField(groupByField string) SearchQueryOptionFunc
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
deprecated
added in
v2.1.0
func WithTravelTimestamp(_ uint64) SearchQueryOptionFunc
Deprecated: time travel is not supported since v2.3.0
type SearchResult ¶
type SearchResult struct { ResultCount int // the returning entry count GroupByValue entity.Column IDs entity.Column // auto generated id, can be mapped to the columns from `Insert` API Fields ResultSet //[]entity.Column // output field data Scores []float32 // distance to the target vector Err error // search error if any // contains filtered or unexported fields }
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
func (*SearchResult) Slice ¶ added in v2.4.2
func (sr *SearchResult) Slice(start, end int) *SearchResult
func (*SearchResult) Unmarshal ¶ added in v2.4.2
func (sr *SearchResult) Unmarshal(receiver interface{}) (err error)
type SearchResultByRows ¶
SearchResultByRows search result for row-based Search
func SearchResultToRows ¶
func SearchResultToRows(sch *entity.Schema, results *schemapb.SearchResultData, t reflect.Type, _ map[string]struct{}) ([]SearchResultByRows, error)
SearchResultToRows converts search result proto to rows
type UpdateResourceGroupsOption ¶ added in v2.4.2
type UpdateResourceGroupsOption func(*milvuspb.UpdateResourceGroupsRequest)
UpdateResourceGroupsOption is an option that is used in UpdateResourceGroups API.
func WithUpdateResourceGroupConfig ¶ added in v2.4.2
func WithUpdateResourceGroupConfig(resourceGroupName string, config *entity.ResourceGroupConfig) UpdateResourceGroupsOption
WithUpdateResourceGroupConfig returns an UpdateResourceGroupsOption that sets the new config to the specified resource group.
Source Files ¶
- admin.go
- alias.go
- ann_request.go
- authentication.go
- client.go
- collection.go
- config.go
- ctx.go
- data.go
- database.go
- errors.go
- grpc_client.go
- index.go
- insert.go
- interceptor.go
- iterator.go
- iterator_option.go
- maintainance.go
- meta_cache.go
- mq_message.go
- options.go
- options_msg_base.go
- partition.go
- rate_limit_interceptor.go
- rbac.go
- reranker.go
- resource_group.go
- results.go
- row.go