mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-21 06:55:03 +00:00
Merge branch 'master' of ssh://github.com/micro/services
This commit is contained in:
@@ -143,7 +143,7 @@ func (s *Search) Index(ctx context.Context, request *pb.IndexRequest, response *
|
|||||||
request.Document.Id = uuid.New().String()
|
request.Document.Id = uuid.New().String()
|
||||||
}
|
}
|
||||||
if len(request.Index) == 0 {
|
if len(request.Index) == 0 {
|
||||||
return errors.BadRequest(method, "Missing index_name param")
|
return errors.BadRequest(method, "Missing index param")
|
||||||
}
|
}
|
||||||
if !isValidIndexName(request.Index) {
|
if !isValidIndexName(request.Index) {
|
||||||
return errors.BadRequest(method, "Index name should contain only alphanumerics and hyphens")
|
return errors.BadRequest(method, "Index name should contain only alphanumerics and hyphens")
|
||||||
@@ -181,6 +181,9 @@ func (s *Search) Delete(ctx context.Context, request *pb.DeleteRequest, response
|
|||||||
if !ok {
|
if !ok {
|
||||||
return errors.Unauthorized(method, "Unauthorized")
|
return errors.Unauthorized(method, "Unauthorized")
|
||||||
}
|
}
|
||||||
|
if len(request.Index) == 0 {
|
||||||
|
return errors.BadRequest(method, "Missing index param")
|
||||||
|
}
|
||||||
req := openapi.DeleteRequest{
|
req := openapi.DeleteRequest{
|
||||||
Index: indexName(tnt, request.Index),
|
Index: indexName(tnt, request.Index),
|
||||||
DocumentID: request.Id,
|
DocumentID: request.Id,
|
||||||
@@ -274,8 +277,11 @@ func (s *Search) DeleteIndex(ctx context.Context, request *pb.DeleteIndexRequest
|
|||||||
if !ok {
|
if !ok {
|
||||||
return errors.Unauthorized(method, "Unauthorized")
|
return errors.Unauthorized(method, "Unauthorized")
|
||||||
}
|
}
|
||||||
req := openapi.DeleteRequest{
|
if len(request.Index) == 0 {
|
||||||
Index: indexName(tnt, request.Index),
|
return errors.BadRequest(method, "Missing index param")
|
||||||
|
}
|
||||||
|
req := openapi.IndicesDeleteRequest{
|
||||||
|
Index: []string{indexName(tnt, request.Index)},
|
||||||
}
|
}
|
||||||
rsp, err := req.Do(ctx, s.client)
|
rsp, err := req.Do(ctx, s.client)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user