2018-01-08 08:54:18 +03:00
|
|
|
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 {
|
2018-11-12 14:07:34 +03:00
|
|
|
ScrollID string `json:"_scroll_id"`
|
|
|
|
Took int `json:"took"`
|
|
|
|
TimedOut bool `json:"timed_out"`
|
|
|
|
Hits Hits `json:"hits"`
|
2018-01-08 08:54:18 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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"`
|
|
|
|
}
|