Current state: Under Discussion
ISSUE: https://github.com/milvus-io/milvus/issues/7700
PRs:
Keywords: Restful API
Released:
Summary(required)
Implement a http server on proxy module, serves http request and convert to same request type as grpc request.
Motivation(required)
Milvus 1.1 used to support restful API, we've also seen many other search engines such as elastic search and solr supports both http and rpc requests. It would be much easier for applications written in language such as PHP and rust to use http to utilize milvus.
Public Interfaces(optional)
TODO: translate gRPC interface in RESTful API.
(see https://github.com/milvus-io/milvus/blob/master/internal/proto/milvus.proto)
According to gRPC, the HTTP resource names can be:
- collections
- partitions
- aliases
- indexes
- rows
APIs:
service MilvusService { // (omit api version prefix) // POST /collections rpc CreateCollection(CreateCollectionRequest) returns (common.Status) {} // DELETE /collections/:collectionName rpc DropCollection(DropCollectionRequest) returns (common.Status) {} // GET /collections/:collectionName rpc HasCollection(HasCollectionRequest) returns (BoolResponse) {} // PUT /collections/:collectionName/load rpc LoadCollection(LoadCollectionRequest) returns (common.Status) {} // DELETE /collections/:collectionName/load rpc ReleaseCollection(ReleaseCollectionRequest) returns (common.Status) {} // GET /collections/:collectionName/schema rpc DescribeCollection(DescribeCollectionRequest) returns (DescribeCollectionResponse) {} // GET /collections/:collectionName/statistics rpc GetCollectionStatistics(GetCollectionStatisticsRequest) returns (GetCollectionStatisticsResponse) {} // GET /collections-list rpc ShowCollections(ShowCollectionsRequest) returns (ShowCollectionsResponse) {} // POST /collections/:collection/partitions rpc CreatePartition(CreatePartitionRequest) returns (common.Status) {} // DELETE /collections/:collection/partitions/:partition rpc DropPartition(DropPartitionRequest) returns (common.Status) {} // GET /collections/:collection/partitions/:partition rpc HasPartition(HasPartitionRequest) returns (BoolResponse) {} // PUT /collections/:collection/partitions/:partition/load rpc LoadPartitions(LoadPartitionsRequest) returns (common.Status) {} // DELETE /collections/:collection/partitions/:partition/load rpc ReleasePartitions(ReleasePartitionsRequest) returns (common.Status) {} // GET /collections/:collection/partitions/:partition/statistics rpc GetPartitionStatistics(GetPartitionStatisticsRequest) returns (GetPartitionStatisticsResponse) {} // GET /collections/:collection/partitions-list rpc ShowPartitions(ShowPartitionsRequest) returns (ShowPartitionsResponse) {} // ... }
Design Details(required)
Add a http server on proxy module with a popular go HTTP framework. (GIN maybe)
The HTTP API should be designed by RESTful Principles and should implement all the methods that gRPC interface supports.
When http server receives a request, it converts the request to corresponding gRPC request, and then reuse the gRPC handling procedure to finish serving the request.
Test Plan(required)
- unit test with the go `httptest` package: example
- Integratin Test with http client.