提交 e483ca06 编写于 作者: Y Yhz

update README.md

Signed-off-by: NYhz <yinghao.zou@zilliz.com>
上级 5eaa7641
...@@ -12,25 +12,28 @@ ...@@ -12,25 +12,28 @@
- [`/config/gpu_resources` (GET)](#configgpu_resources-get) - [`/config/gpu_resources` (GET)](#configgpu_resources-get)
- [`/config/gpu_resources` (PUT)](#configgpu_resources-put) - [`/config/gpu_resources` (PUT)](#configgpu_resources-put)
- [`/config/gpu_resources` (OPTIONS)](#configgpu_resources-options) - [`/config/gpu_resources` (OPTIONS)](#configgpu_resources-options)
- [`/tables` (GET)](#tables-get) - [`/collections` (GET)](#collections-get)
- [`/tables` (POST)](#tables-post) - [`/collections` (POST)](#collections-post)
- [`/tables` (OPTIONS)](#tables-options) - [`/collections` (OPTIONS)](#collections-options)
- [`/tables/{table_name}` (GET)](#tablestable_name-get) - [`/collections/{collection_name}` (GET)](#collectionscollection_name-get)
- [`/tables/{table_name}` (DELETE)](#tablestable_name-delete) - [`/collections/{collection_name}` (DELETE)](#collectionscollection_name-delete)
- [`/tables/{table_name}` (OPTIONS)](#tablestable_name-options) - [`/collections/{collection_name}` (OPTIONS)](#collectionscollection_name-options)
- [`/tables/{table_name}/indexes` (GET)](#tablestable_nameindexes-get) - [`/collections/{collection_name}/indexes` (GET)](#collectionscollection_nameindexes-get)
- [`/tables/{table_name}/indexes` (POST)](#tablestable_nameindexes-post) - [`/collections/{collection_name}/indexes` (POST)](#collectionscollection_nameindexes-post)
- [`/tables/{table_name}/indexes` (DELETE)](#tablestable_nameindexes-delete) - [`/collections/{collection_name}/indexes` (DELETE)](#collectionscollection_nameindexes-delete)
- [`/tables/{table_name}/indexes` (OPTIONS)](#tablestable_nameindexes-options) - [`/collections/{collection_name}/indexes` (OPTIONS)](#collectionscollection_nameindexes-options)
- [`/tables/{table_name}/partitions` (GET)](#tablestable_namepartitions-get) - [`/collections/{collection_name}/partitions` (GET)](#collectionscollection_namepartitions-get)
- [`/tables/{table_name}/partitions` (POST)](#tablestable_namepartitions-post) - [`/collections/{collection_name}/partitions` (POST)](#collectionscollection_namepartitions-post)
- [`/tables/{table_name}/partitions` (OPTIONS)](#tablestable_namepartitions-options) - [`/collections/{collection_name}/partitions` (OPTIONS)](#collectionscollection_namepartitions-options)
- [`/tables/{table_name}/partitions/{partition_tag}` (DELETE)](#tablestable_namepartitionspartition_tag-delete) - [`/collections/{collection_name}/partitions` (DELETE)](#collectionscollection_namepartitions-delete)
- [`/tables/{table_name}/partitions/{partition_tag}` (OPTIONS)](#tablestable_namepartitionspartition_tag-options) - [`/collections/{collection_name}/segments` (GET)](#collectionscollection_namesegments-get)
- [`/tables/{table_name}/vectors` (PUT)](#tablestable_namevectors-put) - [`/collections/{collection_name}/segments/{segment_name}/vectors` (GET)](#collectionscollection_namesegmentssegment_namevectors-get)
- [`/tables/{table_name}/vectors` (POST)](#tablestable_namevectors-post) - [`/collections/{collection_name}/segments/{segment_name}/ids` (GET)](#collectionscollection_namesegmentssegment_nameids-get)
- [`/tables/{table_name}/vectors` (OPTIONS)](#tablestable_namevectors-options) - [`/collections/{collection_name}/vectors` (PUT)](#collectionscollection_namevectors-put)
- [`/collections/{collection_name}/vectors` (POST)](#collectionscollection_namevectors-post)
- [`/collections/{collection_name}/vectors` (OPTIONS)](#collectionscollection_namevectors-options)
- [`/system/{msg}` (GET)](#systemmsg-get) - [`/system/{msg}` (GET)](#systemmsg-get)
- [`system/{op}` (PUT)](#systemop-put)
- [Error Codes](#error-codes) - [Error Codes](#error-codes)
<!-- /TOC --> <!-- /TOC -->
...@@ -334,15 +337,15 @@ Use this API for Cross-Origin Resource Sharing (CORS). ...@@ -334,15 +337,15 @@ Use this API for Cross-Origin Resource Sharing (CORS).
$ curl -X OPTIONS "http://192.168.1.65:19121/config/gpu_resources" $ curl -X OPTIONS "http://192.168.1.65:19121/config/gpu_resources"
``` ```
### `/tables` (GET) ### `/collections` (GET)
Gets all tables starting from `offset` and ends with `page_size`. Gets all collections starting from `offset` and ends with `page_size`.
#### Request #### Request
| Request Component | Value | | Request Component | Value |
|-----------------|---| |-----------------|---|
| Name | `/tables` | | Name | `/collections` |
| Header | `accept: application/json` | | Header | `accept: application/json` |
| Body | N/A | | Body | N/A |
| Method | GET | | Method | GET |
...@@ -367,19 +370,19 @@ Gets all tables starting from `offset` and ends with `page_size`. ...@@ -367,19 +370,19 @@ Gets all tables starting from `offset` and ends with `page_size`.
##### Request ##### Request
```shell ```shell
$ curl -X GET "http://192.168.1.65:19121/tables?offset=0&page_size=1" -H "accept: application/json" $ curl -X GET "http://192.168.1.65:19121/collections?offset=0&page_size=1" -H "accept: application/json"
``` ```
##### Response ##### Response
```json ```json
{"tables":[{"table_name":"test_table","dimension":1,"index_file_size":10,"metric_type":"L2","count":0,"index":"FLAT","nlist":16384}],"count":58} {"collections":[{"collection_name":"test_collection","dimension":1,"index_file_size":10,"metric_type":"L2","count":0,"index":"FLAT","nlist":16384}],"count":58}
``` ```
### `/tables` (POST) ### `/collections` (POST)
Creates a table. Creates a collection.
#### Request #### Request
...@@ -389,7 +392,7 @@ Creates a table. ...@@ -389,7 +392,7 @@ Creates a table.
<tr><td>Header </td><td><pre><code>accept: application/json</code></pre> </td></tr> <tr><td>Header </td><td><pre><code>accept: application/json</code></pre> </td></tr>
<tr><td>Body</td><td><pre><code> <tr><td>Body</td><td><pre><code>
{ {
"table_name": string, "collection_name": string,
"dimension": integer($int64), "dimension": integer($int64),
"index_file_size": integer($int64), "index_file_size": integer($int64),
"metric_type": string "metric_type": string
...@@ -403,8 +406,8 @@ Creates a table. ...@@ -403,8 +406,8 @@ Creates a table.
| Parameter | Description | Required? | | Parameter | Description | Required? |
|-----------------|---|------| |-----------------|---|------|
| `table_name` | The name of the table to create, which must be unique within its database. | Yes | | `collection_name` | The name of the collection to create, which must be unique within its database. | Yes |
| `dimension` | The dimension of the vectors that are to be inserted into the created table. | Yes | | `dimension` | The dimension of the vectors that are to be inserted into the created collection. | Yes |
| `index_file_size` | Threshold value that triggers index building for raw data files. The default is 1024. | No | | `index_file_size` | Threshold value that triggers index building for raw data files. The default is 1024. | No |
| `metric_type` | The method vector distances are compared in Milvus. The default is L2. Currently supported metrics include `L2` (Euclidean distance), `IP` (Inner Product), `HAMMING` (Hamming distance), `JACCARD` (Jaccard distance), and `TANIMOTO` (Tanomoto distance). | No | | `metric_type` | The method vector distances are compared in Milvus. The default is L2. Currently supported metrics include `L2` (Euclidean distance), `IP` (Inner Product), `HAMMING` (Hamming distance), `JACCARD` (Jaccard distance), and `TANIMOTO` (Tanomoto distance). | No |
...@@ -420,7 +423,7 @@ Creates a table. ...@@ -420,7 +423,7 @@ Creates a table.
##### Request ##### Request
```shell ```shell
$ curl -X POST "http://192.168.1.65:19121/tables" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"table_name\":\"test_table\",\"dimension\":1,\"index_file_size\":10,\"metric_type\":\"L2\"}" $ curl -X POST "http://192.168.1.65:19121/collections" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"collection_name\":\"test_collection\",\"dimension\":1,\"index_file_size\":10,\"metric_type\":\"L2\"}"
``` ```
##### Response ##### Response
...@@ -430,7 +433,7 @@ $ curl -X POST "http://192.168.1.65:19121/tables" -H "accept: application/json" ...@@ -430,7 +433,7 @@ $ curl -X POST "http://192.168.1.65:19121/tables" -H "accept: application/json"
{"message":"OK","code":0} {"message":"OK","code":0}
``` ```
### `/tables` (OPTIONS) ### `/collections` (OPTIONS)
Use this API for Cross-Origin Resource Sharing (CORS). Use this API for Cross-Origin Resource Sharing (CORS).
...@@ -438,7 +441,7 @@ Use this API for Cross-Origin Resource Sharing (CORS). ...@@ -438,7 +441,7 @@ Use this API for Cross-Origin Resource Sharing (CORS).
| Request Component | Value | | Request Component | Value |
|-----------------|---| |-----------------|---|
| Name | `/tables` | | Name | `/collections` |
| Header | N/A | | Header | N/A |
| Body | N/A | | Body | N/A |
| Method | OPTIONS | | Method | OPTIONS |
...@@ -449,18 +452,18 @@ Use this API for Cross-Origin Resource Sharing (CORS). ...@@ -449,18 +452,18 @@ Use this API for Cross-Origin Resource Sharing (CORS).
##### Request ##### Request
```shell ```shell
$ curl -X OPTIONS "http://192.168.1.65:19121/tables" $ curl -X OPTIONS "http://192.168.1.65:19121/collections"
``` ```
### `/tables/{table_name}` (GET) ### `/collections/{collection_name}` (GET)
Gets all information about a table by name. Gets all information about a collection by name.
#### Request #### Request
| Request Component | Value | | Request Component | Value |
|-----------------|---| |-----------------|---|
| Name | `/tables/{table_name}` | | Name | `/collections/{collection_name}` |
| Header | `accept: application/json` | | Header | `accept: application/json` |
| Body | N/A | | Body | N/A |
| Method | GET | | Method | GET |
...@@ -470,8 +473,8 @@ Gets all information about a table by name. ...@@ -470,8 +473,8 @@ Gets all information about a table by name.
| Parameter | Description | Required? | | Parameter | Description | Required? |
|-----------------|---|------| |-----------------|---|------|
| `table_name` | Name of the table. | Yes | | `collection_name` | Name of the collection. | Yes |
| `info` | Type of information to acquire. `info` must either be empty or `stat`. When `info` is empty, Milvus returns table name, dimension, index file size, metric type, offset, index type, and nlist of the table. When `info` is `stat`, Milvus returns the table offset, partition status, and segment status. | No | | `info` | Type of information to acquire. `info` must either be empty or `stat`. When `info` is empty, Milvus returns collection name, dimension, index file size, metric type, offset, index type, and nlist of the collection. When `info` is `stat`, Milvus returns the collection offset, partition status, and segment status. | No |
#### Response #### Response
...@@ -487,24 +490,24 @@ Gets all information about a table by name. ...@@ -487,24 +490,24 @@ Gets all information about a table by name.
##### Request ##### Request
```shell ```shell
$ curl -X GET "http://192.168.1.65:19121/tables/test_table" -H "accept: application/json" $ curl -X GET "http://192.168.1.65:19121/collections/test_collection" -H "accept: application/json"
``` ```
##### Response ##### Response
```json ```json
{"table_name":"test_table","dimension":1,"index_file_size":10,"metric_type":"L2","count":0,"index":"FLAT","nlist":16384} {"collection_name":"test_collection","dimension":1,"index_file_size":10,"metric_type":"L2","count":0,"index":"FLAT","nlist":16384}
``` ```
### `/tables/{table_name}` (DELETE) ### `/collections/{collection_name}` (DELETE)
Drops a table by name. Drops a collection by name.
#### Request #### Request
| Request Component | Value | | Request Component | Value |
|-----------------|-----| |-----------------|-----|
| Name | `/tables/{table_name}` | | Name | `/collections/{collection_name}` |
| Header | `accept: application/json` | | Header | `accept: application/json` |
| Body | N/A | | Body | N/A |
| Method | DELETE | | Method | DELETE |
...@@ -513,7 +516,7 @@ Drops a table by name. ...@@ -513,7 +516,7 @@ Drops a table by name.
| Parameter | Description | Required? | | Parameter | Description | Required? |
|-----------------|---|------| |-----------------|---|------|
| `table_name` | Name of the table. | Yes | | `collection_name` | Name of the collection. | Yes |
#### Response #### Response
...@@ -529,12 +532,12 @@ Drops a table by name. ...@@ -529,12 +532,12 @@ Drops a table by name.
```shell ```shell
$ curl -X DELETE "http://192.168.1.65:19121/tables/test_table" -H "accept: application/json" $ curl -X DELETE "http://192.168.1.65:19121/collections/test_collection" -H "accept: application/json"
``` ```
If the deletion is successful, no message will be returned. If the deletion is successful, no message will be returned.
### `/tables/{table_name}` (OPTIONS) ### `/collections/{collection_name}` (OPTIONS)
Use this API for Cross-Origin Resource Sharing (CORS). Use this API for Cross-Origin Resource Sharing (CORS).
...@@ -542,7 +545,7 @@ Use this API for Cross-Origin Resource Sharing (CORS). ...@@ -542,7 +545,7 @@ Use this API for Cross-Origin Resource Sharing (CORS).
| Request Component | Value | | Request Component | Value |
|-----------------|-----| |-----------------|-----|
| Name | `/tables/{table_name}` | | Name | `/collections/{collection_name}` |
| Header | N/A | | Header | N/A |
| Body | N/A | | Body | N/A |
| Method | OPTIONS | | Method | OPTIONS |
...@@ -551,7 +554,7 @@ Use this API for Cross-Origin Resource Sharing (CORS). ...@@ -551,7 +554,7 @@ Use this API for Cross-Origin Resource Sharing (CORS).
| Parameter | Description | Required? | | Parameter | Description | Required? |
|-----------------|---|------| |-----------------|---|------|
| `table_name` | Name of the table. | Yes | | `collection_name` | Name of the collection. | Yes |
#### Example #### Example
...@@ -559,18 +562,18 @@ Use this API for Cross-Origin Resource Sharing (CORS). ...@@ -559,18 +562,18 @@ Use this API for Cross-Origin Resource Sharing (CORS).
##### Request ##### Request
```shell ```shell
$ curl -X OPTIONS "http://192.168.1.65:19121/tables/test_table" $ curl -X OPTIONS "http://192.168.1.65:19121/collections/test_collection"
``` ```
### `/tables/{table_name}/indexes` (GET) ### `/collections/{collection_name}/indexes` (GET)
Gets the index type and nlist of a table. Gets the index type and nlist of a collection.
#### Request #### Request
| Request Component | Value | | Request Component | Value |
|-----------------|-----| |-----------------|-----|
| Name | `/tables/{table_name}/indexes` | | Name | `/collections/{collection_name}/indexes` |
| Header | `accept: application/json` | | Header | `accept: application/json` |
| Body | N/A | | Body | N/A |
| Method | GET | | Method | GET |
...@@ -579,7 +582,7 @@ Gets the index type and nlist of a table. ...@@ -579,7 +582,7 @@ Gets the index type and nlist of a table.
| Parameter | Description | Required? | | Parameter | Description | Required? |
|-----------------|---|------| |-----------------|---|------|
| `table_name` | Name of the table. | Yes | | `collection_name` | Name of the collection. | Yes |
#### Response #### Response
...@@ -594,7 +597,7 @@ Gets the index type and nlist of a table. ...@@ -594,7 +597,7 @@ Gets the index type and nlist of a table.
##### Request ##### Request
```shell ```shell
$ curl -X GET "http://192.168.1.65:19121/tables/test_table/indexes" -H "accept: application/json" $ curl -X GET "http://192.168.1.65:19121/collections/test_collection/indexes" -H "accept: application/json"
``` ```
##### Response ##### Response
...@@ -604,9 +607,9 @@ $ curl -X GET "http://192.168.1.65:19121/tables/test_table/indexes" -H "accept: ...@@ -604,9 +607,9 @@ $ curl -X GET "http://192.168.1.65:19121/tables/test_table/indexes" -H "accept:
{"index_type":"FLAT","nlist":16384} {"index_type":"FLAT","nlist":16384}
``` ```
### `/tables/{table_name}/indexes` (POST) ### `/collections/{collection_name}/indexes` (POST)
Updates the index type and nlist of a table. Updates the index type and nlist of a collection.
#### Request #### Request
...@@ -628,14 +631,14 @@ Updates the index type and nlist of a table. ...@@ -628,14 +631,14 @@ Updates the index type and nlist of a table.
| Parameter | Description | Required? | | Parameter | Description | Required? |
|-----------------|---|------| |-----------------|---|------|
| `index_type` | The type of indexing method to query the table. Please refer to [Index Types](https://www.milvus.io/docs/reference/index.md) for detailed introduction of supported indexes. The default is "FLAT". | No | | `index_type` | The type of indexing method to query the collection. Please refer to [Index Types](https://www.milvus.io/docs/reference/index.md) for detailed introduction of supported indexes. The default is "FLAT". | No |
| `nlist` | Number of vector buckets in a file. The default is 16384. | No | | `nlist` | Number of vector buckets in a file. The default is 16384. | No |
##### Query Parameters ##### Query Parameters
| Parameter | Description | Required? | | Parameter | Description | Required? |
|-----------------|---|------| |-----------------|---|------|
| `table_name` | Name of the table. | Yes | | `collection_name` | Name of the collection. | Yes |
#### Response #### Response
...@@ -658,7 +661,7 @@ Updates the index type and nlist of a table. ...@@ -658,7 +661,7 @@ Updates the index type and nlist of a table.
##### Request ##### Request
```shell ```shell
$ curl -X POST "http://192.168.1.65:19121/tables/test_table/indexes" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"index_type\":\"FLAT\",\"nlist\":16384}" $ curl -X POST "http://192.168.1.65:19121/collections/test_collection/indexes" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"index_type\":\"FLAT\",\"nlist\":16384}"
``` ```
##### Response ##### Response
...@@ -667,15 +670,15 @@ $ curl -X POST "http://192.168.1.65:19121/tables/test_table/indexes" -H "accept: ...@@ -667,15 +670,15 @@ $ curl -X POST "http://192.168.1.65:19121/tables/test_table/indexes" -H "accept:
{"message":"OK","code":0} {"message":"OK","code":0}
``` ```
### `/tables/{table_name}/indexes` (DELETE) ### `/collections/{collection_name}/indexes` (DELETE)
Drops an index for a table. Drops an index for a collection.
#### Request #### Request
| Request Component | Value | | Request Component | Value |
|-----------------|---| |-----------------|---|
| Name | `/tables/{table_name}/indexes` | | Name | `/collections/{collection_name}/indexes` |
| Header | `accept: application/json` | | Header | `accept: application/json` |
| Body | N/A | | Body | N/A |
| Method | DELETE | | Method | DELETE |
...@@ -684,7 +687,7 @@ Drops an index for a table. ...@@ -684,7 +687,7 @@ Drops an index for a table.
| Parameter | Description | Required? | | Parameter | Description | Required? |
|-----------------|---|------| |-----------------|---|------|
| `table_name` | Name of the table. | Yes | | `collection_name` | Name of the collection. | Yes |
#### Response #### Response
...@@ -700,13 +703,13 @@ Drops an index for a table. ...@@ -700,13 +703,13 @@ Drops an index for a table.
##### Request ##### Request
```shell ```shell
$ curl -X DELETE "http://192.168.1.65:19121/tables/test_table/indexes" -H "accept: application/json" $ curl -X DELETE "http://192.168.1.65:19121/collections/test_collection/indexes" -H "accept: application/json"
``` ```
If the deletion is successful, no message will be returned. If the deletion is successful, no message will be returned.
### `/tables/{table_name}/indexes` (OPTIONS) ### `/collections/{collection_name}/indexes` (OPTIONS)
Use this API for Cross-Origin Resource Sharing (CORS). Use this API for Cross-Origin Resource Sharing (CORS).
...@@ -714,7 +717,7 @@ Use this API for Cross-Origin Resource Sharing (CORS). ...@@ -714,7 +717,7 @@ Use this API for Cross-Origin Resource Sharing (CORS).
| Request Component | Value | | Request Component | Value |
|-----------------|---| |-----------------|---|
| Name | `/tables/{table_name}/indexes` | | Name | `/collections/{collection_name}/indexes` |
| Header | N/A | | Header | N/A |
| Body | N/A | | Body | N/A |
| Method | OPTIONS | | Method | OPTIONS |
...@@ -723,25 +726,25 @@ Use this API for Cross-Origin Resource Sharing (CORS). ...@@ -723,25 +726,25 @@ Use this API for Cross-Origin Resource Sharing (CORS).
| Parameter | Description | Required? | | Parameter | Description | Required? |
|-----------------|---|------| |-----------------|---|------|
| `table_name` | Name of the table. | Yes | | `collection_name` | Name of the collection. | Yes |
#### Example #### Example
##### Request ##### Request
```shell ```shell
$ curl -X OPTIONS "http://192.168.1.65:19121/tables/test_table/indexes" $ curl -X OPTIONS "http://192.168.1.65:19121/collections/test_collection/indexes"
``` ```
### `/tables/{table_name}/partitions` (GET) ### `/collections/{collection_name}/partitions` (GET)
Gets all partitions in a table starting from `offset` and ends with `page_size`. Gets all partitions in a collection starting from `offset` and ends with `page_size`.
#### Request #### Request
| Request Component | Value | | Request Component | Value |
|-----------------|-----------| |-----------------|-----------|
| Name | `/tables/{table_name}/partitions` | | Name | `/collections/{collection_name}/partitions` |
| Header | `accept: application/json` | | Header | `accept: application/json` |
| Body | N/A | | Body | N/A |
| Method | GET | | Method | GET |
...@@ -750,7 +753,7 @@ Gets all partitions in a table starting from `offset` and ends with `page_size`. ...@@ -750,7 +753,7 @@ Gets all partitions in a table starting from `offset` and ends with `page_size`.
| Parameter | Description | Required? | | Parameter | Description | Required? |
|-----------------|---|------| |-----------------|---|------|
| `table_name` | Name of the table. | Yes | | `collection_name` | Name of the collection. | Yes |
| `offset` | Row offset from which the data page starts. The default is 0. | No | | `offset` | Row offset from which the data page starts. The default is 0. | No |
| `page_size` | Size of the data page. The default is 10. | No | | `page_size` | Size of the data page. The default is 10. | No |
...@@ -767,7 +770,7 @@ Gets all partitions in a table starting from `offset` and ends with `page_size`. ...@@ -767,7 +770,7 @@ Gets all partitions in a table starting from `offset` and ends with `page_size`.
##### Request ##### Request
```shell ```shell
$ curl -X GET "http://192.168.1.65:19121/tables/test_table/partitions?offset=0&page_size=3" -H "accept: application/json" $ curl -X GET "http://192.168.1.65:19121/collections/test_collection/partitions?offset=0&page_size=3" -H "accept: application/json"
``` ```
##### Response ##### Response
...@@ -776,15 +779,15 @@ $ curl -X GET "http://192.168.1.65:19121/tables/test_table/partitions?offset=0&p ...@@ -776,15 +779,15 @@ $ curl -X GET "http://192.168.1.65:19121/tables/test_table/partitions?offset=0&p
{"partitions":[{"partition_name":"partition_1","partition_tag":"test_tag"},{"partition_name":"partition_2","partition_tag":"test_2"},{"partition_name":"partition_3","partition_tag":"test_3"}]} {"partitions":[{"partition_name":"partition_1","partition_tag":"test_tag"},{"partition_name":"partition_2","partition_tag":"test_2"},{"partition_name":"partition_3","partition_tag":"test_3"}]}
``` ```
### `/tables/{table_name}/partitions` (POST) ### `/collections/{collection_name}/partitions` (POST)
Creates a partition in a table. Creates a partition in a collection.
#### Request #### Request
| Request Component | Value | | Request Component | Value |
|-----------------|-----------| |-----------------|-----------|
| Name | `/tables/{table_name}/partitions` | | Name | `/collections/{collection_name}/partitions` |
| Header | `accept: application/json` | | Header | `accept: application/json` |
| Body | N/A | | Body | N/A |
| Method | POST | | Method | POST |
...@@ -802,7 +805,7 @@ Creates a partition in a table. ...@@ -802,7 +805,7 @@ Creates a partition in a table.
##### Request ##### Request
```shell ```shell
$ curl -X POST "http://192.168.1.65:19121/tables/test_table/partitions" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"partition_name\": \"partition_1\",\"partition_tag\": \"test\"}" $ curl -X POST "http://192.168.1.65:19121/collections/test_collection/partitions" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"partition_name\": \"partition_1\",\"partition_tag\": \"test\"}"
``` ```
##### Response ##### Response
...@@ -811,7 +814,7 @@ $ curl -X POST "http://192.168.1.65:19121/tables/test_table/partitions" -H "acce ...@@ -811,7 +814,7 @@ $ curl -X POST "http://192.168.1.65:19121/tables/test_table/partitions" -H "acce
{"message":"OK","code":0} {"message":"OK","code":0}
``` ```
### `/tables/{table_name}/partitions` (OPTIONS) ### `/collections/{collection_name}/partitions` (OPTIONS)
Use this API for Cross-Origin Resource Sharing (CORS). Use this API for Cross-Origin Resource Sharing (CORS).
...@@ -819,7 +822,7 @@ Use this API for Cross-Origin Resource Sharing (CORS). ...@@ -819,7 +822,7 @@ Use this API for Cross-Origin Resource Sharing (CORS).
| Request Component | Value | | Request Component | Value |
|-----------------|---| |-----------------|---|
| Name | `/tables/{table_name}/partitions` | | Name | `/collections/{collection_name}/partitions` |
| Header | N/A | | Header | N/A |
| Body | N/A | | Body | N/A |
| Method | OPTIONS | | Method | OPTIONS |
...@@ -828,7 +831,7 @@ Use this API for Cross-Origin Resource Sharing (CORS). ...@@ -828,7 +831,7 @@ Use this API for Cross-Origin Resource Sharing (CORS).
| Parameter | Description | Required? | | Parameter | Description | Required? |
|-----------------|---|------| |-----------------|---|------|
| `table_name` | Name of the table. | Yes | | `collection_name` | Name of the collection. | Yes |
#### Example #### Example
...@@ -836,27 +839,33 @@ Use this API for Cross-Origin Resource Sharing (CORS). ...@@ -836,27 +839,33 @@ Use this API for Cross-Origin Resource Sharing (CORS).
##### Request ##### Request
```shell ```shell
$ curl -X OPTIONS "http://192.168.1.65:19121/tables/test_table/partitions" $ curl -X OPTIONS "http://192.168.1.65:19121/collections/test_collection/partitions"
``` ```
### `/tables/{table_name}/partitions/{partition_tag}` (DELETE) ### `/collections/{collection_name}/partitions` (DELETE)
Deletes a partition by tag. Deletes a partition by tag.
#### Request #### Request
| Request Component | Value | <table>
|-----------------|-----------| <tr><th>Request Component</th><th>Value</th></tr>
| Name | `/tables/{table_name}/partitions/{partition_tag}` | <tr><td> Name</td><td><pre><code>/collections/{collection_name}/partitions</code></pre></td></tr>
| Header | `accept: application/json` | <tr><td>Header </td><td><pre><code>accept: application/json</code></pre> </td></tr>
| Body | N/A | <tr><td>Body</td><td><pre><code>
| Method | DELETE | {
"partition_tag": string
}
</code></pre> </td></tr>
<tr><td>Method</td><td>POST</td></tr>
</table>
##### Query Parameters ##### Query Parameters
| Parameter | Description | Required? | | Parameter | Description | Required? |
|-----------------|---|------| |-----------------|---|------|
| `table_name` | Name of the table that contains the partition. | Yes | | `collection_name` | Name of the collection that contains the partition. | Yes |
| `partition_tag` | Tag of the partition to delete. | yes | | `partition_tag` | Tag of the partition to delete. | yes |
#### Response #### Response
...@@ -872,42 +881,173 @@ Deletes a partition by tag. ...@@ -872,42 +881,173 @@ Deletes a partition by tag.
##### Request ##### Request
```shell ```shell
$ curl -X DELETE "http://192.168.1.65:19121/tables/test_table/partitions/tags_01" -H "accept: application/json" $ curl -X DELETE "http://192.168.1.65:19121/collections/test_collection/partitions/tags_01" -H "accept: application/json"
``` ```
The deletion is successful if no information is returned. The deletion is successful if no information is returned.
### `/tables/{table_name}/partitions/{partition_tag}` (OPTIONS)
Use this API for Cross-Origin Resource Sharing (CORS). ### `/collections/{collection_name}/segments` (GET)
Gets all segments in a collection starting from `offset` and ends with `page_size`.
#### Request #### Request
| Request Component | Value | | Request Component | Value |
|-----------------|-----------|
| Name | `/collections/{collection_name}/segments` |
| Header | `accept: application/json` |
| Body | N/A |
| Method | GET |
##### Query Parameters
| Parameter | Description | Required? |
|-----------------|---|------|
| `collection_name` | Name of the collection. | Yes |
| `offset` | Row offset from which the data page starts. The default is 0. | No |
| `page_size` | Size of the data page. The default is 10. | No |
#### Response
| Status code | Description |
|-----------------|---| |-----------------|---|
| Name | `/tables/{table_name}/partitions/{partition_tag}` | | 200 | The request is successful.|
| Header | N/A | | 400 | The request is incorrect. Refer to the error message for details. |
| 404 | The required resource does not exist. |
#### Example
##### Request
```shell
$ curl -X GET "http://192.168.1.65:19121/collections/test_collection/segments?offset=0&page_size=3" -H "accept: application/json"
```
##### Response
```json
{
"code":0,
"message":"OK",
"count":2,
"segments":[
{
"count":10000,
"index":"IVFFLAT",
"partition_tag":"_default",
"segment_name":"1583727470444700000",
"size":5284922
}
]
}
```
### `/collections/{collection_name}/segments/{segment_name}/vectors` (GET)
Gets all vectors of segment in a collection starting from `offset` and ends with `page_size`.
#### Request
| Request Component | Value |
|-----------------|-----------|
| Name | `/collections/{collection_name}/segments` |
| Header | `accept: application/json` |
| Body | N/A | | Body | N/A |
| Method | OPTIONS | | Method | GET |
##### Query Parameters
| Parameter | Description | Required? |
|-----------------|---|------|
| `collection_name` | Name of the collection. | Yes |
| `segment_name` | Name of the segment. | Yes |
| `offset` | Row offset from which the data page starts. The default is 0. | No |
| `page_size` | Size of the data page. The default is 10. | No |
#### Response
| Status code | Description |
|-----------------|---|
| 200 | The request is successful.|
| 400 | The request is incorrect. Refer to the error message for details. |
| 404 | The required resource does not exist. |
#### Example
##### Request
```shell
$ curl -X GET "http://192.168.1.65:19121/collections/test_collection/segments/1583727470444700000/vectors?offset=0&page_size=1" -H "accept: application/json"
```
##### Response
```json
{
"code":0,
"message":"OK",
"count":2,
"vectors": [
{
"vector": [],
"id": ""
}
]
}
```
### `/collections/{collection_name}/segments/{segment_name}/ids` (GET)
Gets all vector ids of segment in a collection starting from `offset` and ends with `page_size`.
#### Request
| Request Component | Value |
|-----------------|-----------|
| Name | `/collections/{collection_name}/segments` |
| Header | `accept: application/json` |
| Body | N/A |
| Method | GET |
##### Query Parameters ##### Query Parameters
| Parameter | Description | Required? | | Parameter | Description | Required? |
|-----------------|---|------| |-----------------|---|------|
| `table_name` | Name of the table. | Yes | | `collection_name` | Name of the collection. | Yes |
| `partition_tag` | Tag of the partition | yes | | `segment_name` | Name of the segment. | Yes |
| `offset` | Row offset from which the data page starts. The default is 0. | No |
| `page_size` | Size of the data page. The default is 10. | No |
#### Response
| Status code | Description |
|-----------------|---|
| 200 | The request is successful.|
| 400 | The request is incorrect. Refer to the error message for details. |
| 404 | The required resource does not exist. |
#### Example #### Example
##### Request ##### Request
```shell ```shell
$ curl -X OPTIONS "http://192.168.1.65:19121/tables/test_table/partitions/tag" $ curl -X GET "http://192.168.1.65:19121/collections/test_collection/segments/1583727470444700000/ids?offset=0&page_size=1" -H "accept: application/json"
```
##### Response
```json
{
"ids": [],
"count": 0
}
``` ```
### `/tables/{table_name}/vectors` (PUT)
Searches vectors in a table. ### `/collections/{collection_name}/vectors` (PUT)
1. Searches vectors in a collection.
#### Request #### Request
...@@ -917,12 +1057,15 @@ Searches vectors in a table. ...@@ -917,12 +1057,15 @@ Searches vectors in a table.
<tr><td>Header </td><td><pre><code>accept: application/json</code></pre> </td></tr> <tr><td>Header </td><td><pre><code>accept: application/json</code></pre> </td></tr>
<tr><td>Body</td><td><pre><code> <tr><td>Body</td><td><pre><code>
{ {
"topk": integer($int64), "search": {
"nprobe": integer($int64), "topk": integer($int64),
"tags": [string], "tags": [string],
"file_ids": [string], "file_ids": [string],
"records": [[number($float)]], "vectors": [[number($float/$uint8)]]
"records_bin": [[number($uint64)]] "params": {
"nprobe": 16
}
}
} }
</code></pre> </td></tr> </code></pre> </td></tr>
<tr><td>Method</td><td>PUT</td></tr> <tr><td>Method</td><td>PUT</td></tr>
...@@ -933,20 +1076,19 @@ Searches vectors in a table. ...@@ -933,20 +1076,19 @@ Searches vectors in a table.
| Parameter | Description | Required? | | Parameter | Description | Required? |
|-----------------|---|------| |-----------------|---|------|
| `topk` | The top k most similar results of each query vector. | Yes | | `topk` | The top k most similar results of each query vector. | Yes |
| `nprobe` | Number of queried vector buckets. | Yes | | `tags` | Tags of partitions that you need to search. You do not have to specify this value if the collection is not partitioned or you wish to search the whole collection. | No |
| `tags` | Tags of partitions that you need to search. You do not have to specify this value if the table is not partitioned or you wish to search the whole table. | No |
| `file_ids` | IDs of the vector files. You do not have to specify this value if you do not use Milvus in distributed scenarios. Also, if you assign a value to `file_ids`, the value of `tags` is ignored. | No | | `file_ids` | IDs of the vector files. You do not have to specify this value if you do not use Milvus in distributed scenarios. Also, if you assign a value to `file_ids`, the value of `tags` is ignored. | No |
| `records` | Numeric vectors to insert to the table. | Yes | | `records` | Numeric vectors to insert to the collection. | Yes |
| `records_bin` | Binary vectors to insert to the table. | Yes | | `records_bin` | Binary vectors to insert to the collection. | Yes |
> Note: Select `records` or `records_bin` depending on the metric used by the table. If the table uses `L2` or `IP`, you must use `records`. If the table uses `HAMMING`, `JACCARD`, or `TANIMOTO`, you must use `records_bin`. > Note: Type of items of vectors depends on the metric used by the collection. If the collection uses `L2` or `IP`, you must use `float`. If the collection uses `HAMMING`, `JACCARD`, or `TANIMOTO`, you must use `uint8`.
##### Query Parameters ##### Query Parameters
| Parameter | Description | Required? | | Parameter | Description | Required? |
|-----------------|---|------| |-----------------|---|------|
| `table_name` | Name of the table. | Yes | | `collection_name` | Name of the collection. | Yes |
#### Response #### Response
...@@ -961,7 +1103,7 @@ Searches vectors in a table. ...@@ -961,7 +1103,7 @@ Searches vectors in a table.
##### Request ##### Request
```shell ```shell
$ curl -X PUT "http://192.168.1.65:19121/tables/test_table/vectors" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"topk\":2,\"nprobe\":16,\"records\":[[0.1]]}" $ curl -X PUT "http://192.168.1.65:19121/collections/test_collection/vectors" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"topk\":2,\"nprobe\":16,\"records\":[[0.1]]}"
``` ```
##### Response ##### Response
...@@ -970,9 +1112,62 @@ $ curl -X PUT "http://192.168.1.65:19121/tables/test_table/vectors" -H "accept: ...@@ -970,9 +1112,62 @@ $ curl -X PUT "http://192.168.1.65:19121/tables/test_table/vectors" -H "accept:
{"num":1,"results":[[{"id":"1578989029645098000","distance":"0.000000"},{"id":"1578989029645098001","distance":"0.010000"}]]} {"num":1,"results":[[{"id":"1578989029645098000","distance":"0.000000"},{"id":"1578989029645098001","distance":"0.010000"}]]}
``` ```
### `/tables/{table_name}/vectors` (POST) 2. Delete vectors
#### Request
<table>
<tr><th>Request Component</th><th>Value</th></tr>
<tr><td> Name</td><td><pre><code>/tables/{table_name}/vectors</code></pre></td></tr>
<tr><td>Header </td><td><pre><code>accept: application/json</code></pre> </td></tr>
<tr><td>Body</td><td><pre><code>
{
"delete": {
"ids": [$string]
}
}
</code></pre> </td></tr>
<tr><td>Method</td><td>PUT</td></tr>
</table>
##### Body Parameters
| Parameter | Description | Required? |
|-----------------|---|------|
| ids | IDs of vectors. | Yes |
##### Query Parameters
| Parameter | Description | Required? |
|-----------------|---|------|
| `collection_name` | Name of the collection. | Yes |
#### Response
| Status code | Description |
|-----------------|---|
| 200 | The request is successful.|
| 400 | The request is incorrect. Refer to the error message for details. |
| 404 | The required resource does not exist. |
#### Example
##### Request
```shell
$ curl -X PUT "http://192.168.1.65:19121/collections/test_collection/vectors" -H "accept: application/json" -H "Content-Type: application/json" -d "{"delete": {"ids": ["1578989029645098000"]}}"
```
##### Response
```json
{"code": 0, "message": "success"}
```
### `/collections/{collection_name}/vectors` (POST)
Inserts vectors to a table. Inserts vectors to a collection.
> Note: It is recommended that you do not insert more than 1 million vectors per request. > Note: It is recommended that you do not insert more than 1 million vectors per request.
...@@ -985,8 +1180,7 @@ Inserts vectors to a table. ...@@ -985,8 +1180,7 @@ Inserts vectors to a table.
<tr><td>Body</td><td><pre><code> <tr><td>Body</td><td><pre><code>
{ {
"tag": string, "tag": string,
"records": [[number($float)]], "vectors": [[number($float/$uint8)]],
“records_bin”:[[number($uint64)]]
"ids": [integer($int64)] "ids": [integer($int64)]
} }
</code></pre> </td></tr> </code></pre> </td></tr>
...@@ -998,17 +1192,16 @@ Inserts vectors to a table. ...@@ -998,17 +1192,16 @@ Inserts vectors to a table.
| Parameter | Description | Required? | | Parameter | Description | Required? |
|-----------------|---|------| |-----------------|---|------|
| `tag` | Tag of the partition to insert vectors to. | No | | `tag` | Tag of the partition to insert vectors to. | No |
| `records` | Numeric vectors to insert to the table. | Yes | | `vectors` | Vectors to insert to the collection. | Yes |
| `records_bin` | Binary vectors to insert to the table. | Yes | | `ids` | IDs of the vectors to insert to the collection. If you assign IDs to the vectors, you must provide IDs for all vectors in the collection. If you do not specify this parameter, Milvus automatically assigns IDs to the vectors. | No |
| `ids` | IDs of the vectors to insert to the table. If you assign IDs to the vectors, you must provide IDs for all vectors in the table. If you do not specify this parameter, Milvus automatically assigns IDs to the vectors. | No |
> Note: Select `records` or `records_bin` depending on the metric used by the table. If the table uses `L2` or `IP`, you must use `records`. If the table uses `HAMMING`, `JACCARD`, or `TANIMOTO`, you must use `records_bin`. > Note: Type of items of `vectors` depends on the metric used by the collection. If the collection uses `L2` or `IP`, you must use `float`. If the collection uses `HAMMING`, `JACCARD`, or `TANIMOTO`, you must use `uint8`.
##### Query Parameters ##### Query Parameters
| Parameter | Description | Required? | | Parameter | Description | Required? |
|-----------------|---|------| |-----------------|---|------|
| `table_name` | Name of the table. | Yes | | `collection_name` | Name of the collection. | Yes |
#### Response #### Response
...@@ -1023,7 +1216,7 @@ Inserts vectors to a table. ...@@ -1023,7 +1216,7 @@ Inserts vectors to a table.
##### Request ##### Request
```shell ```shell
$ curl -X POST "http://192.168.1.65:19121/tables/test_table/vectors" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"records\":[[0.1],[0.2],[0.3],[0.4]]}" $ curl -X POST "http://192.168.1.65:19121/collections/test_collection/vectors" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"vectors\":[[0.1],[0.2],[0.3],[0.4]]}"
``` ```
##### Response ##### Response
...@@ -1032,7 +1225,7 @@ $ curl -X POST "http://192.168.1.65:19121/tables/test_table/vectors" -H "accept: ...@@ -1032,7 +1225,7 @@ $ curl -X POST "http://192.168.1.65:19121/tables/test_table/vectors" -H "accept:
{"ids":["1578989029645098000","1578989029645098001","1578989029645098002","1578989029645098003"]} {"ids":["1578989029645098000","1578989029645098001","1578989029645098002","1578989029645098003"]}
``` ```
### `/tables/{table_name}/vectors` (OPTIONS) ### `/collections/{collection_name}/vectors` (OPTIONS)
Use this API for Cross-Origin Resource Sharing (CORS). Use this API for Cross-Origin Resource Sharing (CORS).
...@@ -1040,7 +1233,7 @@ Use this API for Cross-Origin Resource Sharing (CORS). ...@@ -1040,7 +1233,7 @@ Use this API for Cross-Origin Resource Sharing (CORS).
| Request Component | Value | | Request Component | Value |
|-----------------|---| |-----------------|---|
| Name | `/tables/{table_name}/vectors` | | Name | `/collections/{collection_name}/vectors` |
| Header | N/A | | Header | N/A |
| Body | N/A | | Body | N/A |
| Method | OPTIONS | | Method | OPTIONS |
...@@ -1050,7 +1243,7 @@ Use this API for Cross-Origin Resource Sharing (CORS). ...@@ -1050,7 +1243,7 @@ Use this API for Cross-Origin Resource Sharing (CORS).
##### Request ##### Request
```shell ```shell
$ curl -X OPTIONS "http://192.168.1.65:19121/tables/test_table/vectors" $ curl -X OPTIONS "http://192.168.1.65:19121/collections/test_collection/vectors"
``` ```
### `/system/{msg}` (GET) ### `/system/{msg}` (GET)
...@@ -1093,6 +1286,125 @@ $ curl -X GET "http://192.168.1.65:19121/system/version" -H "accept: application ...@@ -1093,6 +1286,125 @@ $ curl -X GET "http://192.168.1.65:19121/system/version" -H "accept: application
{"reply":"0.7.0"} {"reply":"0.7.0"}
``` ```
### `system/{op}` (PUT)
1. Flush collections
#### Request
<table>
<tr><th>Request Component</th><th>Value</th></tr>
<tr><td> Name</td><td><pre><code>/system/task</code></pre></td></tr>
<tr><td>Header </td><td><pre><code>accept: application/json</code></pre> </td></tr>
<tr><td>Body</td><td><pre><code>
{
"flush": {
"collection_names": [$string]
}
}
</code></pre> </td></tr>
<tr><td>Method</td><td>PUT</td></tr>
</table>
#### Response
| Status code | Description |
|-----------------|---|
| 200 | The request is successful.|
| 400 | The request is incorrect. Refer to the error message for details. |
#### Example
##### Request
```shell
$ curl -X PUT "http://192.168.1.65:19121/system/task" -H "accept: application/json" -d "{\"flush\": {\"collection_names\": [test_collection]}}"
```
##### Response
```json
{"code": 0, "message": "success"}
```
2. Compact collection
#### Request
<table>
<tr><th>Request Component</th><th>Value</th></tr>
<tr><td> Name</td><td><pre><code>/system/task</code></pre></td></tr>
<tr><td>Header </td><td><pre><code>accept: application/json</code></pre> </td></tr>
<tr><td>Body</td><td><pre><code>
{
"compact": {
"collection_name": $string
}
}
</code></pre> </td></tr>
<tr><td>Method</td><td>PUT</td></tr>
</table>
#### Response
| Status code | Description |
|-----------------|---|
| 200 | The request is successful.|
| 400 | The request is incorrect. Refer to the error message for details. |
#### Example
##### Request
```shell
$ curl -X PUT "http://192.168.1.65:19121/system/task" -H "accept: application/json" -d "{\"compact\": {\"collection_name\": test_collection}}"
```
##### Response
```json
{"code": 0, "message": "success"}
```
3. Load collection to memory
#### Request
<table>
<tr><th>Request Component</th><th>Value</th></tr>
<tr><td> Name</td><td><pre><code>/system/task</code></pre></td></tr>
<tr><td>Header </td><td><pre><code>accept: application/json</code></pre> </td></tr>
<tr><td>Body</td><td><pre><code>
{
"load": {
"collection_name": $string
}
}
</code></pre> </td></tr>
<tr><td>Method</td><td>PUT</td></tr>
</table>
#### Response
| Status code | Description |
|-----------------|---|
| 200 | The request is successful.|
| 400 | The request is incorrect. Refer to the error message for details. |
#### Example
##### Request
```shell
$ curl -X PUT "http://192.168.1.65:19121/system/task" -H "accept: application/json" -d "{\"load\": {\"collection_name\": test_collection}}"
```
##### Response
```json
{"code": 0, "message": "success"}
```
## Error Codes ## Error Codes
The RESTful API returns error messages as JSON text. Each type of error message has a specific error code. The RESTful API returns error messages as JSON text. Each type of error message has a specific error code.
...@@ -1125,6 +1437,10 @@ ILLEGAL_NLIST | 22 | ...@@ -1125,6 +1437,10 @@ ILLEGAL_NLIST | 22 |
ILLEGAL_METRIC_TYPE | 23 | ILLEGAL_METRIC_TYPE | 23 |
OUT_OF_MEMORY | 24 | OUT_OF_MEMORY | 24 |
PATH_PARAM_LOSS | 31 | PATH_PARAM_LOSS | 31 |
QUERY_PARAM_LOSS | 32 | UNKNOWN_PATH | 32 |
BODY_FIELD_LOSS | 33 | QUERY_PARAM_LOSS | 33 |
ILLEGAL_QUERY_PARAM | 36 | BODY_FIELD_LOSS | 34 |
ILLEGAL_BODY | 35 |
BODY_PARSE_FAIL | 36 |
ILLEGAL_QUERY_PARAM | 37 |
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册