Merge branch 'master' of ssh://github.com/micro/services

This commit is contained in:
Asim Aslam
2022-01-19 15:01:22 +00:00

View File

@@ -143,7 +143,7 @@ func (s *Search) Index(ctx context.Context, request *pb.IndexRequest, response *
request.Document.Id = uuid.New().String()
}
if len(request.Index) == 0 {
return errors.BadRequest(method, "Missing index_name param")
return errors.BadRequest(method, "Missing index param")
}
if !isValidIndexName(request.Index) {
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 {
return errors.Unauthorized(method, "Unauthorized")
}
if len(request.Index) == 0 {
return errors.BadRequest(method, "Missing index param")
}
req := openapi.DeleteRequest{
Index: indexName(tnt, request.Index),
DocumentID: request.Id,
@@ -274,8 +277,11 @@ func (s *Search) DeleteIndex(ctx context.Context, request *pb.DeleteIndexRequest
if !ok {
return errors.Unauthorized(method, "Unauthorized")
}
req := openapi.DeleteRequest{
Index: indexName(tnt, request.Index),
if len(request.Index) == 0 {
return errors.BadRequest(method, "Missing index param")
}
req := openapi.IndicesDeleteRequest{
Index: []string{indexName(tnt, request.Index)},
}
rsp, err := req.Do(ctx, s.client)
if err != nil {