搜索结果结构
| 72 | |
| 73 | //搜索结果结构 |
| 74 | type ElasticSearchResult struct { |
| 75 | Shards struct { |
| 76 | Failed int `json:"failed"` |
| 77 | Skipped int `json:"skipped"` |
| 78 | Successful int `json:"successful"` |
| 79 | Total int `json:"total"` |
| 80 | } `json:"_shards"` |
| 81 | Hits struct { |
| 82 | Hits []struct { |
| 83 | ID string `json:"_id"` |
| 84 | Index string `json:"_index"` |
| 85 | Score interface{} `json:"_score"` |
| 86 | Source struct { |
| 87 | Id int `json:"id"` |
| 88 | BookId int `json:"book_id"` |
| 89 | Title string `json:"title"` |
| 90 | Keywords string `json:"keywords"` |
| 91 | Content string `json:"content"` |
| 92 | Vcnt int `json:"vcnt"` |
| 93 | Private int `json:"private"` |
| 94 | } `json:"_source"` |
| 95 | Type string `json:"_type"` |
| 96 | Sort []int `json:"sort"` |
| 97 | } `json:"hits"` |
| 98 | MaxScore interface{} `json:"max_score"` |
| 99 | Total int `json:"total"` |
| 100 | } `json:"hits"` |
| 101 | TimedOut bool `json:"timed_out"` |
| 102 | Took int `json:"took"` |
| 103 | } |
| 104 | |
| 105 | //创建全文搜索客户端 |
| 106 | func NewElasticSearchClient() (client *ElasticSearchClient) { |
nothing calls this directly
no outgoing calls
no test coverage detected