milvus/internal/proto/schema.proto
SimFG d7f38a803d
Separate some proto files (#19218)
Signed-off-by: SimFG <bang.fu@zilliz.com>

Signed-off-by: SimFG <bang.fu@zilliz.com>
2022-09-16 16:56:49 +08:00

141 lines
2.5 KiB
Protocol Buffer

syntax = "proto3";
package milvus.proto.schema;
option go_package = "github.com/milvus-io/milvus/api/schemapb";
option java_multiple_files = true;
option java_package = "io.milvus.grpc";
option java_outer_classname = "SchemaProto";
option java_generate_equals_and_hash = true;
import "common.proto";
/**
* @brief Field data type
*/
enum DataType {
None = 0;
Bool = 1;
Int8 = 2;
Int16 = 3;
Int32 = 4;
Int64 = 5;
Float = 10;
Double = 11;
String = 20;
VarChar = 21; // variable-length strings with a specified maximum length
BinaryVector = 100;
FloatVector = 101;
}
enum FieldState {
FieldCreated = 0;
FieldCreating = 1;
FieldDropping = 2;
FieldDropped = 3;
}
/**
* @brief Field schema
*/
message FieldSchema {
int64 fieldID = 1;
string name = 2;
bool is_primary_key = 3;
string description = 4;
DataType data_type = 5;
repeated common.KeyValuePair type_params = 6;
repeated common.KeyValuePair index_params = 7;
bool autoID = 8;
FieldState state = 9; // To keep compatible with older version, the default state is `Created`.
}
/**
* @brief Collection schema
*/
message CollectionSchema {
string name = 1;
string description = 2;
bool autoID = 3; // deprecated later, keep compatible with c++ part now
repeated FieldSchema fields = 4;
}
message BoolArray {
repeated bool data = 1;
}
message IntArray {
repeated int32 data = 1;
}
message LongArray {
repeated int64 data = 1;
}
message FloatArray {
repeated float data = 1;
}
message DoubleArray {
repeated double data = 1;
}
// For special fields such as bigdecimal, array...
message BytesArray {
repeated bytes data = 1;
}
message StringArray {
repeated string data = 1;
}
message ScalarField {
oneof data {
BoolArray bool_data = 1;
IntArray int_data = 2;
LongArray long_data = 3;
FloatArray float_data = 4;
DoubleArray double_data = 5;
StringArray string_data = 6;
BytesArray bytes_data = 7;
}
}
message VectorField {
int64 dim = 1;
oneof data {
FloatArray float_vector = 2;
bytes binary_vector = 3;
}
}
message FieldData {
DataType type = 1;
string field_name = 2;
oneof field {
ScalarField scalars = 3;
VectorField vectors = 4;
}
int64 field_id = 5;
}
message IDs {
oneof id_field {
LongArray int_id = 1;
StringArray str_id = 2;
}
}
message SearchResultData {
int64 num_queries = 1;
int64 top_k = 2;
repeated FieldData fields_data = 3;
repeated float scores = 4;
IDs ids = 5;
repeated int64 topks = 6;
}