diff --git a/search/handler/search.go b/search/handler/search.go index 273fbb3..216f741 100644 --- a/search/handler/search.go +++ b/search/handler/search.go @@ -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 {