Merge branch 'master' of ssh://git.infini.ltd:64221/infini/console
This commit is contained in:
commit
c8cd0b80a4
|
@ -33,7 +33,7 @@ type Notification struct {
|
|||
Type NotificationType `json:"type,omitempty" elastic_mapping:"type:{type:keyword,fields:{text: {type: text}}}"`
|
||||
MessageType MessageType `json:"message_type,omitempty" elastic_mapping:"message_type:{type:keyword,fields:{text: {type: text}}}"`
|
||||
Status NotificationStatus `json:"status,omitempty" elastic_mapping:"status: { type: keyword }"`
|
||||
Title string `json:"title,omitempty" elastic_mapping:"title: { type: keyword }"`
|
||||
Body string `json:"body,omitempty" elastic_mapping:"body: { type: keyword }"`
|
||||
Title string `json:"title,omitempty" elastic_mapping:"title: { type: text }"`
|
||||
Body string `json:"body,omitempty" elastic_mapping:"body: { type: text }"`
|
||||
Link string `json:"link,omitempty" elastic_mapping:"link: { type: keyword }"`
|
||||
}
|
||||
|
|
|
@ -15,10 +15,11 @@ import (
|
|||
)
|
||||
|
||||
type SearchNotificationsRequest struct {
|
||||
From int `json:"from"`
|
||||
Size int `json:"size"`
|
||||
Status []model.NotificationStatus `json:"status"`
|
||||
Types []model.NotificationType `json:"types"`
|
||||
From int `json:"from"`
|
||||
Size int `json:"size"`
|
||||
Keyword string `json:"keyword"`
|
||||
Status []model.NotificationStatus `json:"status"`
|
||||
Types []model.NotificationType `json:"types"`
|
||||
}
|
||||
|
||||
func (h *NotificationAPI) searchNotifications(w http.ResponseWriter, req *http.Request, ps httprouter.Params) {
|
||||
|
@ -55,6 +56,9 @@ func (h *NotificationAPI) searchNotifications(w http.ResponseWriter, req *http.R
|
|||
if len(reqData.Types) > 0 {
|
||||
musts = append(musts, util.MapStr{"terms": util.MapStr{"type": reqData.Types}})
|
||||
}
|
||||
if len(reqData.Keyword) > 0 {
|
||||
musts = append(musts, util.MapStr{"query_string": util.MapStr{"default_field": "*", "query": reqData.Keyword}})
|
||||
}
|
||||
|
||||
var (
|
||||
queryDSL = util.MapStr{
|
||||
|
|
Loading…
Reference in New Issue