model.go 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. package eapi
  2. type M map[string]interface{}
  3. // SearchModel 基本搜索模型
  4. type SearchModel struct {
  5. Took int `json:"took"`
  6. TimedOut bool `json:"timed_out"`
  7. Shards struct {
  8. Total int `json:"total"`
  9. Successful int `json:"successful"`
  10. Skipped int `json:"skipped"`
  11. Failed int `json:"failed"`
  12. } `json:"_shards"`
  13. Hits struct {
  14. Total struct {
  15. Value int `json:"value"`
  16. Relation string `json:"relation"`
  17. } `json:"total"`
  18. MaxScore interface{} `json:"max_score"`
  19. Hits []struct {
  20. Index string `json:"_index"`
  21. Id string `json:"_id"`
  22. Score interface{} `json:"_score"`
  23. Source interface{} `json:"_source"`
  24. Sort []int `json:"sort"`
  25. } `json:"hits"`
  26. } `json:"hits"`
  27. }
  28. // CountModel 统计行数
  29. type CountModel struct {
  30. Count int64 `json:"count"`
  31. Shards struct {
  32. Total int `json:"total"`
  33. Successful int `json:"successful"`
  34. Skipped int `json:"skipped"`
  35. Failed int `json:"failed"`
  36. } `json:"_shards"`
  37. }
  38. // CardinalityModel 去重统计行数
  39. type CardinalityModel struct {
  40. Took int `json:"took"`
  41. TimedOut bool `json:"timed_out"`
  42. Shards struct {
  43. Total int `json:"total"`
  44. Successful int `json:"successful"`
  45. Skipped int `json:"skipped"`
  46. Failed int `json:"failed"`
  47. } `json:"_shards"`
  48. Hits struct {
  49. Total struct {
  50. Value int `json:"value"`
  51. Relation string `json:"relation"`
  52. } `json:"total"`
  53. MaxScore interface{} `json:"max_score"`
  54. Hits []interface{} `json:"hits"`
  55. } `json:"hits"`
  56. Aggregations struct {
  57. Count struct {
  58. Value int64 `json:"value"`
  59. } `json:"count"`
  60. } `json:"aggregations"`
  61. }
  62. // FirstModel 第一条数据
  63. type FirstModel struct {
  64. Took int `json:"took"`
  65. TimedOut bool `json:"timed_out"`
  66. Shards struct {
  67. Total int `json:"total"`
  68. Successful int `json:"successful"`
  69. Skipped int `json:"skipped"`
  70. Failed int `json:"failed"`
  71. } `json:"_shards"`
  72. Hits struct {
  73. Total struct {
  74. Value int `json:"value"`
  75. Relation string `json:"relation"`
  76. } `json:"total"`
  77. MaxScore interface{} `json:"max_score"`
  78. Hits []struct {
  79. Index string `json:"_index"`
  80. Id string `json:"_id"`
  81. Score interface{} `json:"_score"`
  82. Source interface{} `json:"_source"`
  83. Sort []int `json:"sort"`
  84. } `json:"hits"`
  85. } `json:"hits"`
  86. }
  87. // LastModel 最后一条数据
  88. type LastModel struct {
  89. Took int `json:"took"`
  90. TimedOut bool `json:"timed_out"`
  91. Shards struct {
  92. Total int `json:"total"`
  93. Successful int `json:"successful"`
  94. Skipped int `json:"skipped"`
  95. Failed int `json:"failed"`
  96. } `json:"_shards"`
  97. Hits struct {
  98. Total struct {
  99. Value int `json:"value"`
  100. Relation string `json:"relation"`
  101. } `json:"total"`
  102. MaxScore interface{} `json:"max_score"`
  103. Hits []struct {
  104. Index string `json:"_index"`
  105. Id string `json:"_id"`
  106. Score interface{} `json:"_score"`
  107. Source interface{} `json:"_source"`
  108. Sort []int `json:"sort"`
  109. } `json:"hits"`
  110. } `json:"hits"`
  111. }
  112. // TopListModel 排行榜
  113. type TopListModel struct {
  114. Took int `json:"took"`
  115. TimedOut bool `json:"timed_out"`
  116. Shards struct {
  117. Total int `json:"total"`
  118. Successful int `json:"successful"`
  119. Skipped int `json:"skipped"`
  120. Failed int `json:"failed"`
  121. } `json:"_shards"`
  122. Hits struct {
  123. Total struct {
  124. Value int `json:"value"`
  125. Relation string `json:"relation"`
  126. } `json:"total"`
  127. MaxScore float64 `json:"max_score"`
  128. Hits []struct {
  129. Index string `json:"_index"`
  130. Id string `json:"_id"`
  131. Score float64 `json:"_score"`
  132. } `json:"hits"`
  133. } `json:"hits"`
  134. Aggregations struct {
  135. Vals struct {
  136. DocCountErrorUpperBound int `json:"doc_count_error_upper_bound"`
  137. SumOtherDocCount int `json:"sum_other_doc_count"`
  138. Buckets []TopBucket `json:"buckets"`
  139. } `json:"vals"`
  140. } `json:"aggregations"`
  141. }
  142. // TopBucket 排行榜桶
  143. type TopBucket struct {
  144. Key int64 `json:"key"`
  145. DocCount int64 `json:"doc_count"`
  146. }
  147. // TopSumScoreListModel 聚合字段的排行榜
  148. type TopSumScoreListModel struct {
  149. Took int `json:"took"`
  150. TimedOut bool `json:"timed_out"`
  151. Shards struct {
  152. Total int `json:"total"`
  153. Successful int `json:"successful"`
  154. Skipped int `json:"skipped"`
  155. Failed int `json:"failed"`
  156. } `json:"_shards"`
  157. Hits struct {
  158. Total struct {
  159. Value int `json:"value"`
  160. Relation string `json:"relation"`
  161. } `json:"total"`
  162. MaxScore interface{} `json:"max_score"`
  163. Hits []interface{} `json:"hits"`
  164. } `json:"hits"`
  165. Aggregations struct {
  166. Vals struct {
  167. DocCountErrorUpperBound int `json:"doc_count_error_upper_bound"`
  168. SumOtherDocCount int `json:"sum_other_doc_count"`
  169. Buckets []TopSumScoreBucket `json:"buckets"`
  170. } `json:"vals"`
  171. } `json:"aggregations"`
  172. }
  173. // TopSumScoreBucket 排行榜桶
  174. type TopSumScoreBucket struct {
  175. Key int64 `json:"key"`
  176. DocCount int64 `json:"doc_count"`
  177. SumScore struct {
  178. Value float64 `json:"value"`
  179. } `json:"sum_score"`
  180. }