diff --git a/model/rbac/user.go b/model/rbac/user.go index 266379a9..1cd131b3 100644 --- a/model/rbac/user.go +++ b/model/rbac/user.go @@ -9,8 +9,8 @@ type User struct { Name string `json:"name" elastic_mapping:"name:{type:keyword}"` Phone string `json:"phone" elastic_mapping:"phone:{type:keyword}"` Email string `json:"email" elastic_mapping:"email:{type:keyword}"` - Roles []UserRole `json:"roles" elastic_mapping:"roles:{type:text}"` - Tags []string `json:"tags" elastic_mapping:"tags:{type:text}"` + Roles []UserRole `json:"roles"` + Tags []string `json:"tags,omitempty" elastic_mapping:"tags:{type:text}"` } type UserRole struct { Id string `json:"id" elastic_mapping:"id:{type:keyword}"` diff --git a/plugin/api/rbac/user.go b/plugin/api/rbac/user.go index 5b8c1de2..d9bff0de 100644 --- a/plugin/api/rbac/user.go +++ b/plugin/api/rbac/user.go @@ -150,7 +150,7 @@ func (h Rbac) SearchUser(w http.ResponseWriter, r *http.Request, ps httprouter.P return } - h.WriteOKJSON(w, core.Response{Hit: res.Result, Total: res.Total}) + h.WriteOKJSON(w, res) return }