milvus.proto 12.7 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 Flush(FlushRequest) returns (FlushResponse) {}
X
Xiangyu Wang 已提交
36
  rpc Query(QueryRequest) returns (QueryResults) {}
37
  rpc CalcDistance(CalcDistanceRequest) returns (CalcDistanceResults) {}
G
godchen 已提交
38 39 40 41

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

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

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

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

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

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

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

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

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

message DescribeCollectionResponse {
Y
yukun 已提交
89 90
  common.Status status = 1;
  schema.CollectionSchema schema = 2;
91
  int64 collectionID = 3;
92 93
  repeated string virtual_channel_names = 4;
  repeated string physical_channel_names = 5;
94 95
  uint64 created_timestamp = 6; // hybrid timestamp
  uint64 created_utc_timestamp = 7; // physical timestamp
96 97 98
}

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

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

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

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

121
enum ShowType {
122 123 124 125
  All = 0;
  InMemory = 1;
}

G
godchen 已提交
126
message ShowCollectionsRequest {
Z
zhenshan.cao 已提交
127
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
128
  string db_name = 2;
N
neza2017 已提交
129
  uint64 time_stamp = 3;
130 131
  ShowType type = 4;
  repeated string collection_names = 5; // show collection in querynode, showType = InMemory
132 133
}

G
godchen 已提交
134
message ShowCollectionsResponse {
Z
zhenshan.cao 已提交
135 136
  common.Status status = 1;
  repeated string collection_names = 2;
137
  repeated int64 collection_ids = 3;
138 139
  repeated uint64 created_timestamps = 4; // hybrid timestamps
  repeated uint64 created_utc_timestamps = 5; // physical timestamps
140
  repeated int64 inMemory_percentages = 6; // load percentage on querynode
141 142 143
}

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

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

message HasPartitionRequest {
Z
zhenshan.cao 已提交
158
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
159
  string db_name = 2;
Z
zhenshan.cao 已提交
160 161
  string collection_name = 3; // must
  string partition_name = 4; // must
162 163
}

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

G
godchen 已提交
171
message ReleasePartitionsRequest {
Z
zhenshan.cao 已提交
172
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
173
  string db_name = 2;
Z
zhenshan.cao 已提交
174 175
  string collection_name = 3; // must
  repeated string partition_names = 4; // must
176 177
}

G
godchen 已提交
178
message GetPartitionStatisticsRequest {
Z
zhenshan.cao 已提交
179
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
180
  string db_name = 2;
Z
zhenshan.cao 已提交
181 182
  string collection_name = 3; // must
  string partition_name = 4; // must
183 184
}

G
godchen 已提交
185
message GetPartitionStatisticsResponse {
Z
zhenshan.cao 已提交
186 187
  common.Status status = 1;
  repeated common.KeyValuePair stats = 2;
188 189
}

G
godchen 已提交
190
message ShowPartitionsRequest {
Z
zhenshan.cao 已提交
191
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
192
  string db_name = 2;
Z
zhenshan.cao 已提交
193
  string collection_name = 3; // must
194
  int64 collectionID = 4;
195 196
  repeated string partition_names = 5; // show partition in querynode, showType = InMemory
  ShowType type = 6;
197 198
}

G
godchen 已提交
199
message ShowPartitionsResponse {
Z
zhenshan.cao 已提交
200 201 202
  common.Status status = 1;
  repeated string partition_names = 2;
  repeated int64 partitionIDs = 3;
203 204
  repeated uint64 created_timestamps = 4; // hybrid timestamps
  repeated uint64 created_utc_timestamps = 5; // physical timestamps
205
  repeated int64 inMemory_percentages = 6; // load percentage on querynode
206 207 208 209 210 211 212 213 214 215 216
}

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

message DescribeSegmentResponse {
  common.Status status = 1;
  int64 indexID = 2;
N
neza2017 已提交
217
  int64 buildID = 3;
218
  bool enable_index = 4;
219 220
}

G
godchen 已提交
221
message ShowSegmentsRequest {
222 223 224 225 226
  common.MsgBase base = 1;
  int64 collectionID = 2;
  int64 partitionID = 3;
}

G
godchen 已提交
227
message ShowSegmentsResponse {
228 229 230
  common.Status status = 1;
  repeated int64 segmentIDs = 2;
}
231 232

message CreateIndexRequest {
Z
zhenshan.cao 已提交
233
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
234
  string db_name = 2;
Z
zhenshan.cao 已提交
235 236 237
  string collection_name = 3; // must
  string field_name = 4; // must
  repeated common.KeyValuePair extra_params = 5; // must
238 239 240
}

message DescribeIndexRequest {
Z
zhenshan.cao 已提交
241
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
242
  string db_name = 2;
Z
zhenshan.cao 已提交
243
  string collection_name = 3; // must
244
  string field_name = 4;
Z
zhenshan.cao 已提交
245
  string index_name = 5; // No need to set up for now @2021.06.30
246 247 248 249
}

message IndexDescription {
  string index_name = 1;
G
godchen 已提交
250
  int64 indexID = 2;
251
  repeated common.KeyValuePair params = 3;
252
  string field_name = 4;
253 254 255
}

message DescribeIndexResponse {
256 257 258 259
  common.Status status = 1;
  repeated IndexDescription index_descriptions = 2;
}

260
message GetIndexBuildProgressRequest {
Z
zhenshan.cao 已提交
261
  common.MsgBase base = 1; // must
262
  string db_name = 2 ;
Z
zhenshan.cao 已提交
263
  string collection_name = 3; // must
264
  string field_name = 4;
Z
zhenshan.cao 已提交
265
  string index_name = 5; // must
266 267 268 269 270 271 272 273
}

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

G
godchen 已提交
274
message GetIndexStateRequest {
Z
zhenshan.cao 已提交
275
  common.MsgBase base = 1; // must
276
  string db_name = 2 ;
Z
zhenshan.cao 已提交
277
  string collection_name = 3; // must
278
  string field_name = 4;
Z
zhenshan.cao 已提交
279
  string index_name = 5; // No need to set up for now @2021.06.30
280 281
}

G
godchen 已提交
282
message GetIndexStateResponse {
283 284
  common.Status status = 1;
  common.IndexState state = 2;
285
  string fail_reason = 3;
286 287
}

X
xige-16 已提交
288
message DropIndexRequest {
Z
zhenshan.cao 已提交
289
  common.MsgBase base = 1; // must
X
xige-16 已提交
290
  string db_name = 2;
Z
zhenshan.cao 已提交
291
  string collection_name = 3; // must
X
xige-16 已提交
292
  string field_name = 4;
Z
zhenshan.cao 已提交
293
  string index_name = 5; // No need to set up for now @2021.06.30
X
xige-16 已提交
294 295
}

296
message InsertRequest {
297
  common.MsgBase base = 1;
Z
zhenshan.cao 已提交
298
  string db_name = 2;
299 300 301 302
  string collection_name = 3;
  string partition_name = 4;
  repeated schema.FieldData fields_data = 5;
  repeated uint32 hash_keys = 6;
303
  uint32 num_rows = 7;
304 305
}

306
message MutationResult {
Z
zhenshan.cao 已提交
307
  common.Status status = 1;
308 309 310 311 312 313 314 315
  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 已提交
316 317 318
}

enum PlaceholderType {
G
godchen 已提交
319 320 321
  None = 0;
  BinaryVector = 100;
  FloatVector = 101;
Y
yukun 已提交
322 323 324 325 326 327 328 329 330 331 332
}

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;
333 334 335
}

message SearchRequest {
Z
zhenshan.cao 已提交
336
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
337
  string db_name = 2;
Z
zhenshan.cao 已提交
338 339 340
  string collection_name = 3; // must
  repeated string partition_names = 4; // must
  string dsl = 5; // must
Y
yukun 已提交
341
  // serialized `PlaceholderGroup`
Z
zhenshan.cao 已提交
342 343
  bytes placeholder_group = 6; // must
  common.DslType dsl_type = 7; // must
344 345 346
  repeated string output_fields = 8;
  repeated common.KeyValuePair search_params = 9; // must
  uint64 travel_timestamp = 10;
347
  uint64 guarantee_timestamp = 11; // guarantee_timestamp
Y
yukun 已提交
348 349 350 351 352 353 354 355
}

message Hits {
  repeated int64 IDs = 1;
  repeated bytes row_data = 2;
  repeated float scores = 3;
}

356
message SearchResults {
Y
yukun 已提交
357
  common.Status status = 1;
358
  schema.SearchResultData results = 2;
359 360 361
}

message FlushRequest {
362
  common.MsgBase base = 1;
363
  string db_name = 2;
364
  repeated string collection_names = 3;
Y
yukun 已提交
365 366
}

367 368 369 370 371 372
message FlushResponse{
  common.Status status = 1;
  string db_name = 2;
  map<string, schema.LongArray> coll_segIDs = 3;
}

X
Xiangyu Wang 已提交
373 374 375 376 377 378 379
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;
380 381
  uint64 travel_timestamp = 7;
  uint64 guarantee_timestamp = 8; // guarantee_timestamp
X
Xiangyu Wang 已提交
382 383 384 385 386 387 388
}

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

389 390 391 392 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
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 已提交
419 420 421 422
message PersistentSegmentInfo {
  int64 segmentID = 1;
  int64 collectionID = 2;
  int64 partitionID = 3;
423 424
  int64 num_rows = 4;
  common.SegmentState state = 5;
Z
zhenshan.cao 已提交
425 426
}

G
godchen 已提交
427
message GetPersistentSegmentInfoRequest {
Z
zhenshan.cao 已提交
428
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
429
  string dbName = 2;
Z
zhenshan.cao 已提交
430
  string collectionName = 3; // must
Z
zhenshan.cao 已提交
431 432
}

G
godchen 已提交
433
message GetPersistentSegmentInfoResponse {
Z
zhenshan.cao 已提交
434 435 436 437
  common.Status status = 1;
  repeated PersistentSegmentInfo infos = 2;
}

Z
zhenshan.cao 已提交
438 439 440 441 442 443 444 445 446 447
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 已提交
448
message GetQuerySegmentInfoRequest {
Z
zhenshan.cao 已提交
449
  common.MsgBase base = 1; // must
Z
zhenshan.cao 已提交
450
  string dbName = 2;
Z
zhenshan.cao 已提交
451
  string collectionName = 3; // must
Z
zhenshan.cao 已提交
452 453
}

G
godchen 已提交
454
message GetQuerySegmentInfoResponse {
Z
zhenshan.cao 已提交
455 456 457 458
  common.Status status = 1;
  repeated QuerySegmentInfo infos = 2;
}

X
Xiangyu Wang 已提交
459 460 461 462 463 464 465
message DummyRequest {
  string request_type = 1;
}

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

G
godchen 已提交
467
message RegisterLinkRequest {
Y
yukun 已提交
468
}
D
dragondriver 已提交
469 470 471 472 473 474

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

475 476 477 478 479 480 481 482 483 484 485
message GetMetricsRequest {
  common.MsgBase base = 1;
  string request = 2; // request is of jsonic format
}

message GetMetricsResponse {
  common.Status status = 1;
  string response = 2;  // response is of jsonic format
  string component_name = 3; // metrics from which component
}

D
dragondriver 已提交
486
service ProxyService {
G
godchen 已提交
487
  rpc RegisterLink(RegisterLinkRequest) returns (RegisterLinkResponse) {}
D
dragondriver 已提交
488
}