fetcher/i2es/documents.go

49 lines
1.1 KiB
Go

package i2es
// ESDoc Elasticsearch document structure
type ESDoc struct {
Echo string `json:"echo"`
Subg string `json:"subg"`
To string `json:"to"`
Author string `json:"author"`
Message string `json:"message"`
Date string `json:"date"`
MsgID string `json:"msgid"`
Tags string `json:"tags"`
Repto string `json:"repto"`
Address string `json:"address"`
TopicID string `json:"topicid"`
Misplaced string `json:"misplaced"`
}
// ESConf ES connection settings
type ESConf struct {
Host string
Index string
Type string
}
// ESRes ES response structure
type ESRes struct {
ScrollID string `json:"_scroll_id"`
Took int `json:"took"`
TimedOut bool `json:"timed_out"`
Hits Hits `json:"hits"`
}
// Hits Founded documents
type Hits struct {
Total int `json:"total"`
MaxScore float32 `json:"max_score"`
Hits []Hit `json:"hits"`
}
// ES Document
type Hit struct {
Index string `json:"_index"`
Type string `json:"_type"`
ID string `json:"_id"`
Score float32 `json:"_score"`
Source ESDoc `json:"_source"`
}