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}}}"`
|
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}}}"`
|
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 }"`
|
Status NotificationStatus `json:"status,omitempty" elastic_mapping:"status: { type: keyword }"`
|
||||||
Title string `json:"title,omitempty" elastic_mapping:"title: { type: keyword }"`
|
Title string `json:"title,omitempty" elastic_mapping:"title: { type: text }"`
|
||||||
Body string `json:"body,omitempty" elastic_mapping:"body: { type: keyword }"`
|
Body string `json:"body,omitempty" elastic_mapping:"body: { type: text }"`
|
||||||
Link string `json:"link,omitempty" elastic_mapping:"link: { type: keyword }"`
|
Link string `json:"link,omitempty" elastic_mapping:"link: { type: keyword }"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ import (
|
||||||
type SearchNotificationsRequest struct {
|
type SearchNotificationsRequest struct {
|
||||||
From int `json:"from"`
|
From int `json:"from"`
|
||||||
Size int `json:"size"`
|
Size int `json:"size"`
|
||||||
|
Keyword string `json:"keyword"`
|
||||||
Status []model.NotificationStatus `json:"status"`
|
Status []model.NotificationStatus `json:"status"`
|
||||||
Types []model.NotificationType `json:"types"`
|
Types []model.NotificationType `json:"types"`
|
||||||
}
|
}
|
||||||
|
@ -55,6 +56,9 @@ func (h *NotificationAPI) searchNotifications(w http.ResponseWriter, req *http.R
|
||||||
if len(reqData.Types) > 0 {
|
if len(reqData.Types) > 0 {
|
||||||
musts = append(musts, util.MapStr{"terms": util.MapStr{"type": reqData.Types}})
|
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 (
|
var (
|
||||||
queryDSL = util.MapStr{
|
queryDSL = util.MapStr{
|
||||||
|
|
Loading…
Reference in New Issue