milvus.proto 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. syntax = "proto3";
  2. import "status.proto";
  3. option java_multiple_files = true;
  4. option java_package = "io.milvus.grpc";
  5. option java_outer_classname = "MilvusProto";
  6. package milvus.grpc;
  7. /**
  8. * @brief Table Name
  9. */
  10. message TableName {
  11. string table_name = 1;
  12. }
  13. /**
  14. * @brief Table Name List
  15. */
  16. message TableNameList {
  17. Status status = 1;
  18. repeated string table_names = 2;
  19. }
  20. /**
  21. * @brief Table Schema
  22. */
  23. message TableSchema {
  24. Status status = 1;
  25. string table_name = 2;
  26. int64 dimension = 3;
  27. int64 index_file_size = 4;
  28. int32 metric_type = 5;
  29. }
  30. /**
  31. * @brief Range Schema
  32. */
  33. message Range {
  34. string start_value = 1;
  35. string end_value = 2;
  36. }
  37. /**
  38. * @brief Record inserted
  39. */
  40. message RowRecord {
  41. repeated float vector_data = 1; //binary vector data
  42. }
  43. /**
  44. * @brief params to be inserted
  45. */
  46. message InsertParam {
  47. string table_name = 1;
  48. repeated RowRecord row_record_array = 2;
  49. repeated int64 row_id_array = 3; //optional
  50. }
  51. /**
  52. * @brief Vector ids
  53. */
  54. message VectorIds {
  55. Status status = 1;
  56. repeated int64 vector_id_array = 2;
  57. }
  58. /**
  59. * @brief params for searching vector
  60. */
  61. message SearchParam {
  62. string table_name = 1;
  63. repeated RowRecord query_record_array = 2;
  64. repeated Range query_range_array = 3;
  65. int64 topk = 4;
  66. int64 nprobe = 5;
  67. }
  68. /**
  69. * @brief params for searching vector in files
  70. */
  71. message SearchInFilesParam {
  72. repeated string file_id_array = 1;
  73. SearchParam search_param = 2;
  74. }
  75. /**
  76. * @brief Query result params
  77. */
  78. message TopKQueryResult {
  79. Status status = 1;
  80. int64 row_num = 2;
  81. repeated int64 ids = 3;
  82. repeated float distances = 4;
  83. }
  84. /**
  85. * @brief Server String Reply
  86. */
  87. message StringReply {
  88. Status status = 1;
  89. string string_reply = 2;
  90. }
  91. /**
  92. * @brief Server bool Reply
  93. */
  94. message BoolReply {
  95. Status status = 1;
  96. bool bool_reply = 2;
  97. }
  98. /**
  99. * @brief Return table row count
  100. */
  101. message TableRowCount {
  102. Status status = 1;
  103. int64 table_row_count = 2;
  104. }
  105. /**
  106. * @brief Give Server Command
  107. */
  108. message Command {
  109. string cmd = 1;
  110. }
  111. /**
  112. * @brief Index
  113. * @index_type: 0-invalid, 1-idmap, 2-ivflat, 3-ivfsq8, 4-nsgmix
  114. * @metric_type: 1-L2, 2-IP
  115. */
  116. message Index {
  117. int32 index_type = 1;
  118. int32 nlist = 2;
  119. }
  120. /**
  121. * @brief Index params
  122. */
  123. message IndexParam {
  124. Status status = 1;
  125. string table_name = 2;
  126. Index index = 3;
  127. }
  128. /**
  129. * @brief table name and range for DeleteByRange
  130. */
  131. message DeleteByRangeParam {
  132. Range range = 1;
  133. string table_name = 2;
  134. }
  135. service MilvusService {
  136. /**
  137. * @brief Create table method
  138. *
  139. * This method is used to create table
  140. *
  141. * @param param, use to provide table information to be created.
  142. *
  143. */
  144. rpc CreateTable (TableSchema) returns (Status) {
  145. }
  146. /**
  147. * @brief Test table existence method
  148. *
  149. * This method is used to test table existence.
  150. *
  151. * @param table_name, table name is going to be tested.
  152. *
  153. */
  154. rpc HasTable (TableName) returns (BoolReply) {
  155. }
  156. /**
  157. * @brief Delete table method
  158. *
  159. * This method is used to delete table.
  160. *
  161. * @param table_name, table name is going to be deleted.
  162. *
  163. */
  164. rpc DropTable (TableName) returns (Status) {
  165. }
  166. /**
  167. * @brief Build index by table method
  168. *
  169. * This method is used to build index by table in sync mode.
  170. *
  171. * @param table_name, table is going to be built index.
  172. *
  173. */
  174. rpc CreateIndex (IndexParam) returns (Status) {
  175. }
  176. /**
  177. * @brief Add vector array to table
  178. *
  179. * This method is used to add vector array to table.
  180. *
  181. * @param table_name, table_name is inserted.
  182. * @param record_array, vector array is inserted.
  183. *
  184. * @return vector id array
  185. */
  186. rpc Insert (InsertParam) returns (VectorIds) {
  187. }
  188. /**
  189. * @brief Query vector
  190. *
  191. * This method is used to query vector in table.
  192. *
  193. * @param table_name, table_name is queried.
  194. * @param query_record_array, all vector are going to be queried.
  195. * @param query_range_array, optional ranges for conditional search. If not specified, search whole table
  196. * @param topk, how many similarity vectors will be searched.
  197. *
  198. * @return query result array.
  199. */
  200. rpc Search (SearchParam) returns (TopKQueryResult) {
  201. }
  202. /**
  203. * @brief Internal use query interface
  204. *
  205. * This method is used to query vector in specified files.
  206. *
  207. * @param file_id_array, specified files id array, queried.
  208. * @param query_record_array, all vector are going to be queried.
  209. * @param query_range_array, optional ranges for conditional search. If not specified, search whole table
  210. * @param topk, how many similarity vectors will be searched.
  211. *
  212. * @return query result array.
  213. */
  214. rpc SearchInFiles (SearchInFilesParam) returns (TopKQueryResult) {
  215. }
  216. /**
  217. * @brief Get table schema
  218. *
  219. * This method is used to get table schema.
  220. *
  221. * @param table_name, target table name.
  222. *
  223. * @return table schema
  224. */
  225. rpc DescribeTable (TableName) returns (TableSchema) {
  226. }
  227. /**
  228. * @brief Get table schema
  229. *
  230. * This method is used to get table schema.
  231. *
  232. * @param table_name, target table name.
  233. *
  234. * @return table schema
  235. */
  236. rpc CountTable (TableName) returns (TableRowCount) {
  237. }
  238. /**
  239. * @brief List all tables in database
  240. *
  241. * This method is used to list all tables.
  242. *
  243. *
  244. * @return table names.
  245. */
  246. rpc ShowTables (Command) returns (TableNameList) {
  247. }
  248. /**
  249. * @brief Give the server status
  250. *
  251. * This method is used to give the server status.
  252. *
  253. * @return Server status.
  254. */
  255. rpc Cmd (Command) returns (StringReply) {
  256. }
  257. /**
  258. * @brief delete table by range
  259. *
  260. * This method is used to delete vector by range
  261. *
  262. * @return rpc status.
  263. */
  264. rpc DeleteByRange (DeleteByRangeParam) returns (Status) {
  265. }
  266. /**
  267. * @brief preload table
  268. *
  269. * This method is used to preload table
  270. *
  271. * @return Status.
  272. */
  273. rpc PreloadTable (TableName) returns (Status) {
  274. }
  275. /**
  276. * @brief describe index
  277. *
  278. * This method is used to describe index
  279. *
  280. * @return Status.
  281. */
  282. rpc DescribeIndex (TableName) returns (IndexParam) {
  283. }
  284. /**
  285. * @brief drop index
  286. *
  287. * This method is used to drop index
  288. *
  289. * @return Status.
  290. */
  291. rpc DropIndex (TableName) returns (Status) {
  292. }
  293. }