diff --git a/internal/app/model/es.go b/internal/app/model/es.go index 759e06d..af235fc 100644 --- a/internal/app/model/es.go +++ b/internal/app/model/es.go @@ -88,13 +88,11 @@ type LogResp struct { } type ProcessLog struct { - Id int `json:"id,omitempty" gorm:"primaryKey;autoIncrement;column:id" ` - Log string `json:"log" gorm:"column:log"` - Word string `json:"word,omitempty"` - Logkeyword string `json:"logkeyword,omitempty"` - Time int64 `json:"time" gorm:"column:time"` - Name string `json:"name" gorm:"column:name"` - Using string `json:"using" gorm:"column:using"` + Id int `json:"id,omitempty" gorm:"primaryKey;autoIncrement;column:id" ` + Log string `json:"log" gorm:"column:log"` + Time int64 `json:"time" gorm:"column:time"` + Name string `json:"name" gorm:"column:name"` + Using string `json:"using" gorm:"column:using"` } func (n *ProcessLog) TableName() string { diff --git a/internal/app/search/bleve/bleve.go b/internal/app/search/bleve/bleve.go index 7555c80..0f8ed2d 100644 --- a/internal/app/search/bleve/bleve.go +++ b/internal/app/search/bleve/bleve.go @@ -42,8 +42,6 @@ func (b *bleveSearch) Init() error { mapping := bleve.NewDocumentMapping() log := bleve.NewTextFieldMapping() log.Index = true - logkeyword := bleve.NewKeywordFieldMapping() - logkeyword.Index = true time := bleve.NewNumericFieldMapping() time.Index = true name := bleve.NewKeywordFieldMapping() @@ -51,7 +49,6 @@ func (b *bleveSearch) Init() error { using := bleve.NewKeywordFieldMapping() using.Index = true mapping.AddFieldMappingsAt("log", log) - mapping.AddFieldMappingsAt("logkeyword", logkeyword) mapping.AddFieldMappingsAt("time", time) mapping.AddFieldMappingsAt("name", name) mapping.AddFieldMappingsAt("using", using) @@ -70,11 +67,10 @@ func (b *bleveSearch) Init() error { func (b *bleveSearch) Insert(logContent string, processName string, using string, ts int64) { if err := b.index.Index(uuid.NewString(), model.ProcessLog{ - Log: logContent, - Name: processName, - Logkeyword: logContent, - Using: using, - Time: ts, + Log: logContent, + Name: processName, + Using: using, + Time: ts, }); err != nil { logger.Logger.Warnw("bleve log insert failed", "err", err) } @@ -95,11 +91,11 @@ func (b *bleveSearch) Search(req model.GetLogReq, filterProcessName ...string) ( buildQuery.AddMustNot(logQuery) case sr.WildCard: logQuery := bleve.NewWildcardQuery("*" + v.Content + "*") - logQuery.SetField("logkeyword") + logQuery.SetField("log") buildQuery.AddMust(logQuery) case sr.NotWildCard: logQuery := bleve.NewWildcardQuery("*" + v.Content + "*") - logQuery.SetField("logkeyword") + logQuery.SetField("log") buildQuery.AddMustNot(logQuery) } }