milvus.proto 12.2 KB
Newer Older
1 2 3
syntax = "proto3";
package milvus.proto.milvus;

X
Xiangyu Wang 已提交
4
option go_package = "github.com/milvus-io/milvus/internal/proto/milvuspb";
5 6

import "common.proto";
Y
yukun 已提交
7
import "schema.proto";
8

G
godchen 已提交
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
service MilvusService {
  rpc CreateCollection(CreateCollectionRequest) returns (common.Status) {}
  rpc DropCollection(DropCollectionRequest) returns (common.Status) {}
  rpc HasCollection(HasCollectionRequest) returns (BoolResponse) {}
  rpc LoadCollection(LoadCollectionRequest) returns (common.Status) {}
  rpc ReleaseCollection(ReleaseCollectionRequest) returns (common.Status) {}
  rpc DescribeCollection(DescribeCollectionRequest) returns (DescribeCollectionResponse) {}
  rpc GetCollectionStatistics(GetCollectionStatisticsRequest) returns (GetCollectionStatisticsResponse) {}
  rpc ShowCollections(ShowCollectionsRequest) returns (ShowCollectionsResponse) {}

  rpc CreatePartition(CreatePartitionRequest) returns (common.Status) {}
  rpc DropPartition(DropPartitionRequest) returns (common.Status) {}
  rpc HasPartition(HasPartitionRequest) returns (BoolResponse) {}
  rpc LoadPartitions(LoadPartitionsRequest) returns (common.Status) {}
  rpc ReleasePartitions(ReleasePartitionsRequest) returns (common.Status) {}
  rpc GetPartitionStatistics(GetPartitionStatisticsRequest) returns (GetPartitionStatisticsResponse) {}
  rpc ShowPartitions(ShowPartitionsRequest) returns (ShowPartitionsResponse) {}

  rpc CreateIndex(CreateIndexRequest) returns (common.Status) {}
  rpc DescribeIndex(DescribeIndexRequest) returns (DescribeIndexResponse) {}
  rpc GetIndexState(GetIndexStateRequest) returns (GetIndexStateResponse) {}
30
  rpc GetIndexBuildProgress(GetIndexBuildProgressRequest) returns (GetIndexBuildProgressResponse) {}
G
godchen 已提交
31 32
  rpc DropIndex(DropIndexRequest) returns (common.Status) {}

33
  rpc Insert(InsertRequest) returns (MutationResult) {}
G
godchen 已提交
34
  rpc Search(SearchRequest) returns (SearchResults) {}
35
  rpc Retrieve(RetrieveRequest) returns (RetrieveResults) {}
36
  rpc Flush(FlushRequest) returns (FlushResponse) {}
X
Xiangyu Wang 已提交
37
  rpc Query(QueryRequest) returns (QueryResults) {}
38
  rpc CalcDistance(CalcDistanceRequest) returns (CalcDistanceResults) {}
G
godchen 已提交
39 40 41 42

  rpc GetPersistentSegmentInfo(GetPersistentSegmentInfoRequest) returns (GetPersistentSegmentInfoResponse) {}
  rpc GetQuerySegmentInfo(GetQuerySegmentInfoRequest) returns (GetQuerySegmentInfoResponse) {}

X
Xiangyu Wang 已提交
43 44
  rpc Dummy(DummyRequest) returns (DummyResponse) {}

G
godchen 已提交
45 46 47 48
  // TODO: remove
  rpc RegisterLink(RegisterLinkRequest) returns (RegisterLinkResponse) {}
}

49
message CreateCollectionRequest {
Z
zhenshan.cao 已提交
50
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
51
  string db_name = 2;
Z
zhenshan.cao 已提交
52
  string collection_name = 3; // must
Y
yukun 已提交
53
  // `schema` is the serialized `schema.CollectionSchema`
Z
zhenshan.cao 已提交
54 55
  bytes schema = 4; // must
  int32 shards_num = 5; // must. Once set, no modification is allowed
56 57 58
}

message DropCollectionRequest {
Z
zhenshan.cao 已提交
59
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
60
  string db_name = 2;
Z
zhenshan.cao 已提交
61
  string collection_name = 3; // must
62 63 64
}

message HasCollectionRequest {
Z
zhenshan.cao 已提交
65
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
66
  string db_name = 2;
Z
zhenshan.cao 已提交
67
  string collection_name = 3; // must
N
neza2017 已提交
68
  uint64 time_stamp = 4;
69 70
}

Y
yukun 已提交
71 72 73 74 75
message BoolResponse {
  common.Status status = 1;
  bool value = 2;
}

Z
zhenshan.cao 已提交
76 77 78 79 80
message StringResponse {
  common.Status status = 1;
  string value = 2;
}

81
message DescribeCollectionRequest {
Z
zhenshan.cao 已提交
82
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
83
  string db_name = 2;
Z
zhenshan.cao 已提交
84
  string collection_name = 3; // must
N
neza2017 已提交
85
  int64 collectionID = 4;
N
neza2017 已提交
86
  uint64 time_stamp = 5;
87 88 89
}

message DescribeCollectionResponse {
Y
yukun 已提交
90 91
  common.Status status = 1;
  schema.CollectionSchema schema = 2;
92
  int64 collectionID = 3;
93 94
  repeated string virtual_channel_names = 4;
  repeated string physical_channel_names = 5;
95 96 97
}

message LoadCollectionRequest {
Z
zhenshan.cao 已提交
98
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
99
  string db_name = 2;
Z
zhenshan.cao 已提交
100
  string collection_name = 3; // must
101 102 103
}

message ReleaseCollectionRequest {
Z
zhenshan.cao 已提交
104
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
105
  string db_name = 2;
Z
zhenshan.cao 已提交
106
  string collection_name = 3; // must
107 108
}

G
godchen 已提交
109
message GetCollectionStatisticsRequest {
Z
zhenshan.cao 已提交
110
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
111
  string db_name = 2;
Z
zhenshan.cao 已提交
112
  string collection_name = 3; // must
113 114
}

G
godchen 已提交
115
message GetCollectionStatisticsResponse {
Z
zhenshan.cao 已提交
116 117
  common.Status status = 1;
  repeated common.KeyValuePair stats = 2;
118 119
}

120 121 122 123 124
enum ShowCollectionsType {
  All = 0;
  InMemory = 1;
}

G
godchen 已提交
125
message ShowCollectionsRequest {
Z
zhenshan.cao 已提交
126
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
127
  string db_name = 2;
N
neza2017 已提交
128
  uint64 time_stamp = 3;
129
  ShowCollectionsType type = 4;
130 131
}

G
godchen 已提交
132
message ShowCollectionsResponse {
Z
zhenshan.cao 已提交
133 134
  common.Status status = 1;
  repeated string collection_names = 2;
135
  repeated int64 collection_ids = 3;
136 137 138
}

message CreatePartitionRequest {
Z
zhenshan.cao 已提交
139
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
140
  string db_name = 2;
Z
zhenshan.cao 已提交
141 142
  string collection_name = 3; // must
  string partition_name = 4; // must
143 144 145
}

message DropPartitionRequest {
Z
zhenshan.cao 已提交
146
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
147
  string db_name = 2;
Z
zhenshan.cao 已提交
148 149
  string collection_name = 3; // must
  string partition_name = 4; // must
150 151 152
}

message HasPartitionRequest {
Z
zhenshan.cao 已提交
153
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
154
  string db_name = 2;
Z
zhenshan.cao 已提交
155 156
  string collection_name = 3; // must
  string partition_name = 4; // must
157 158
}

G
godchen 已提交
159
message LoadPartitionsRequest {
Z
zhenshan.cao 已提交
160
  common.MsgBase base = 1; // must
161
  string db_name = 2;
Z
zhenshan.cao 已提交
162 163
  string collection_name = 3; // must
  repeated string partition_names = 4; // must
164 165
}

G
godchen 已提交
166
message ReleasePartitionsRequest {
Z
zhenshan.cao 已提交
167
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
168
  string db_name = 2;
Z
zhenshan.cao 已提交
169 170
  string collection_name = 3; // must
  repeated string partition_names = 4; // must
171 172
}

G
godchen 已提交
173
message GetPartitionStatisticsRequest {
Z
zhenshan.cao 已提交
174
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
175
  string db_name = 2;
Z
zhenshan.cao 已提交
176 177
  string collection_name = 3; // must
  string partition_name = 4; // must
178 179
}

G
godchen 已提交
180
message GetPartitionStatisticsResponse {
Z
zhenshan.cao 已提交
181 182
  common.Status status = 1;
  repeated common.KeyValuePair stats = 2;
183 184
}

G
godchen 已提交
185
message ShowPartitionsRequest {
Z
zhenshan.cao 已提交
186
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
187
  string db_name = 2;
Z
zhenshan.cao 已提交
188
  string collection_name = 3; // must
189
  int64 collectionID = 4;
190 191
}

G
godchen 已提交
192
message ShowPartitionsResponse {
Z
zhenshan.cao 已提交
193 194 195
  common.Status status = 1;
  repeated string partition_names = 2;
  repeated int64 partitionIDs = 3;
196 197 198 199 200 201 202 203 204 205 206
}

message DescribeSegmentRequest {
  common.MsgBase base = 1;
  int64 collectionID = 2;
  int64 segmentID = 3;
}

message DescribeSegmentResponse {
  common.Status status = 1;
  int64 indexID = 2;
N
neza2017 已提交
207
  int64 buildID = 3;
208
  bool enable_index = 4;
209 210
}

G
godchen 已提交
211
message ShowSegmentsRequest {
212 213 214 215 216
  common.MsgBase base = 1;
  int64 collectionID = 2;
  int64 partitionID = 3;
}

G
godchen 已提交
217
message ShowSegmentsResponse {
218 219 220
  common.Status status = 1;
  repeated int64 segmentIDs = 2;
}
221 222

message CreateIndexRequest {
Z
zhenshan.cao 已提交
223
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
224
  string db_name = 2;
Z
zhenshan.cao 已提交
225 226 227
  string collection_name = 3; // must
  string field_name = 4; // must
  repeated common.KeyValuePair extra_params = 5; // must
228 229 230
}

message DescribeIndexRequest {
Z
zhenshan.cao 已提交
231
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
232
  string db_name = 2;
Z
zhenshan.cao 已提交
233
  string collection_name = 3; // must
234
  string field_name = 4;
Z
zhenshan.cao 已提交
235
  string index_name = 5; // No need to set up for now @2021.06.30
236 237 238 239
}

message IndexDescription {
  string index_name = 1;
G
godchen 已提交
240
  int64 indexID = 2;
241
  repeated common.KeyValuePair params = 3;
242
  string field_name = 4;
243 244 245
}

message DescribeIndexResponse {
246 247 248 249
  common.Status status = 1;
  repeated IndexDescription index_descriptions = 2;
}

250
message GetIndexBuildProgressRequest {
Z
zhenshan.cao 已提交
251
  common.MsgBase base = 1; // must
252
  string db_name = 2 ;
Z
zhenshan.cao 已提交
253
  string collection_name = 3; // must
254
  string field_name = 4;
Z
zhenshan.cao 已提交
255
  string index_name = 5; // must
256 257 258 259 260 261 262 263
}

message GetIndexBuildProgressResponse {
  common.Status status = 1;
  int64 indexed_rows = 2;
  int64 total_rows = 3;
}

G
godchen 已提交
264
message GetIndexStateRequest {
Z
zhenshan.cao 已提交
265
  common.MsgBase base = 1; // must
266
  string db_name = 2 ;
Z
zhenshan.cao 已提交
267
  string collection_name = 3; // must
268
  string field_name = 4;
Z
zhenshan.cao 已提交
269
  string index_name = 5; // No need to set up for now @2021.06.30
270 271
}

G
godchen 已提交
272
message GetIndexStateResponse {
273 274
  common.Status status = 1;
  common.IndexState state = 2;
275 276
}

X
xige-16 已提交
277
message DropIndexRequest {
Z
zhenshan.cao 已提交
278
  common.MsgBase base = 1; // must
X
xige-16 已提交
279
  string db_name = 2;
Z
zhenshan.cao 已提交
280
  string collection_name = 3; // must
X
xige-16 已提交
281
  string field_name = 4;
Z
zhenshan.cao 已提交
282
  string index_name = 5; // No need to set up for now @2021.06.30
X
xige-16 已提交
283 284
}

285
message InsertRequest {
286
  common.MsgBase base = 1;
Z
zhenshan.cao 已提交
287
  string db_name = 2;
288 289 290 291
  string collection_name = 3;
  string partition_name = 4;
  repeated schema.FieldData fields_data = 5;
  repeated uint32 hash_keys = 6;
292
  uint32 num_rows = 7;
293 294
}

295
message MutationResult {
Z
zhenshan.cao 已提交
296
  common.Status status = 1;
297 298 299 300 301 302 303 304
  schema.IDs IDs = 2; // required for insert, delete
  repeated uint32 succ_index = 3; // error indexes indicate
  repeated uint32 err_index = 4; // error indexes indicate
  bool acknowledged = 5;
  int64 insert_cnt = 6;
  int64 delete_cnt = 7;
  int64 upsert_cnt = 8;
  uint64 timestamp = 9;
Y
yukun 已提交
305 306 307
}

enum PlaceholderType {
G
godchen 已提交
308 309 310
  None = 0;
  BinaryVector = 100;
  FloatVector = 101;
Y
yukun 已提交
311 312 313 314 315 316 317 318 319 320 321
}

message PlaceholderValue {
  string tag = 1;
  PlaceholderType type = 2;
  // values is a 2d-array, every array contains a vector
  repeated bytes values = 3;
}

message PlaceholderGroup {
  repeated PlaceholderValue placeholders = 1;
322 323 324
}

message SearchRequest {
Z
zhenshan.cao 已提交
325
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
326
  string db_name = 2;
Z
zhenshan.cao 已提交
327 328 329
  string collection_name = 3; // must
  repeated string partition_names = 4; // must
  string dsl = 5; // must
Y
yukun 已提交
330
  // serialized `PlaceholderGroup`
Z
zhenshan.cao 已提交
331 332
  bytes placeholder_group = 6; // must
  common.DslType dsl_type = 7; // must
333 334 335
  repeated string output_fields = 8;
  repeated common.KeyValuePair search_params = 9; // must
  uint64 travel_timestamp = 10;
336
  uint64 guarantee_timestamp = 11; // guarantee_timestamp
Y
yukun 已提交
337 338
}

339
message RetrieveRequest {
Z
zhenshan.cao 已提交
340
  common.MsgBase base = 1; // must
341
  string db_name = 2;
Z
zhenshan.cao 已提交
342 343 344 345
  string collection_name = 3; // must
  repeated string partition_names = 4; // must
  schema.IDs ids = 5; // must
  repeated string output_fields = 6; // must
346
  uint64 travel_timestamp = 7;
347
  uint64 guarantee_timestamp = 8; // guarantee_timestamp
348 349 350 351 352 353 354 355
}

message RetrieveResults {
  common.Status status = 1;
  schema.IDs ids = 2;
  repeated schema.FieldData fields_data = 3;
}

Y
yukun 已提交
356 357 358 359 360 361
message Hits {
  repeated int64 IDs = 1;
  repeated bytes row_data = 2;
  repeated float scores = 3;
}

362
message SearchResults {
Y
yukun 已提交
363
  common.Status status = 1;
364
  schema.SearchResultData results = 2;
365 366 367
}

message FlushRequest {
368
  common.MsgBase base = 1;
369
  string db_name = 2;
370
  repeated string collection_names = 3;
Y
yukun 已提交
371 372
}

373 374 375 376 377 378
message FlushResponse{
  common.Status status = 1;
  string db_name = 2;
  map<string, schema.LongArray> coll_segIDs = 3;
}

X
Xiangyu Wang 已提交
379 380 381 382 383 384 385 386 387 388 389 390 391 392
message QueryRequest {
  common.MsgBase base = 1;
  string db_name = 2;
  string collection_name = 3;
  string expr = 4;
  repeated string output_fields = 5;
  repeated string partition_names = 6;
}

message QueryResults {
  common.Status status = 1;
  repeated schema.FieldData fields_data = 2;
}

393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422
message VectorIDs {
  string collection_name = 1;
  string field_name = 2;
  schema.IDs id_array = 3;
  repeated string partition_names = 4;
}

message VectorsArray {
  oneof array {
    VectorIDs id_array = 1; // vector ids
    schema.VectorField data_array = 2; // vectors data
  } 
}

message CalcDistanceRequest {
  common.MsgBase base = 1;
  VectorsArray op_left = 2; // vectors on the left of operator
  VectorsArray op_right = 3; // vectors on the right of operator
  repeated common.KeyValuePair params = 4; // "metric":"L2"/"IP"/"HAMMIN"/"TANIMOTO"
}

message CalcDistanceResults {
  common.Status status = 1;
  // num(op_left)*num(op_right) distance values, "HAMMIN" return integer distance
  oneof array {
    	schema.IntArray int_dist = 2;
	schema.FloatArray float_dist = 3;
  }
}

Z
zhenshan.cao 已提交
423 424 425 426
message PersistentSegmentInfo {
  int64 segmentID = 1;
  int64 collectionID = 2;
  int64 partitionID = 3;
427 428
  int64 num_rows = 4;
  common.SegmentState state = 5;
Z
zhenshan.cao 已提交
429 430
}

G
godchen 已提交
431
message GetPersistentSegmentInfoRequest {
Z
zhenshan.cao 已提交
432
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
433
  string dbName = 2;
Z
zhenshan.cao 已提交
434
  string collectionName = 3; // must
Z
zhenshan.cao 已提交
435 436
}

G
godchen 已提交
437
message GetPersistentSegmentInfoResponse {
Z
zhenshan.cao 已提交
438 439 440 441
  common.Status status = 1;
  repeated PersistentSegmentInfo infos = 2;
}

Z
zhenshan.cao 已提交
442 443 444 445 446 447 448 449 450 451
message QuerySegmentInfo {
  int64 segmentID = 1;
  int64 collectionID = 2;
  int64 partitionID = 3;
  int64 mem_size = 4;
  int64 num_rows = 5;
  string index_name = 6;
  int64 indexID = 7;
}

G
godchen 已提交
452
message GetQuerySegmentInfoRequest {
Z
zhenshan.cao 已提交
453
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
454
  string dbName = 2;
Z
zhenshan.cao 已提交
455
  string collectionName = 3; // must
Z
zhenshan.cao 已提交
456 457
}

G
godchen 已提交
458
message GetQuerySegmentInfoResponse {
Z
zhenshan.cao 已提交
459 460 461 462
  common.Status status = 1;
  repeated QuerySegmentInfo infos = 2;
}

X
Xiangyu Wang 已提交
463 464 465 466 467 468 469
message DummyRequest {
  string request_type = 1;
}

message DummyResponse {
  string response = 1;
}
Z
zhenshan.cao 已提交
470

G
godchen 已提交
471
message RegisterLinkRequest {
Y
yukun 已提交
472
}
D
dragondriver 已提交
473 474 475 476 477 478 479

message RegisterLinkResponse {
  common.Address address = 1;
  common.Status status = 2;
}

service ProxyService {
G
godchen 已提交
480
  rpc RegisterLink(RegisterLinkRequest) returns (RegisterLinkResponse) {}
D
dragondriver 已提交
481
}