es_controller.go 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package web_hook
  2. import (
  3. "eta/eta_mini_ht_api/common/component/es"
  4. "eta/eta_mini_ht_api/controllers"
  5. )
  6. type ESController struct {
  7. controllers.WebHookController
  8. }
  9. func elastic() *es.ESClient {
  10. return es.GetInstance()
  11. }
  12. //// DeleteEsData 删除es数据
  13. //// @Summary 删除es数据
  14. //// @Description 删除es数据
  15. //// @Success 200 {object} controllers.BaseResponse
  16. //// @router /es/delete/ [post]
  17. //func (h *ESController) DeleteEsData() {
  18. // controllers.WrapWebhook(&h.WebHookController, func() (result *controllers.WrapData, err error) {
  19. // result = h.InitWrapData("删除成功")
  20. // ids := []int{10605, 10636, 10637, 10638, 10648, 10794, 10839, 10899, 10903, 11002, 11082, 11127, 11276, 11277, 11279, 11280, 11281, 11283, 11284, 11285, 11286, 11287, 11288, 11290, 11291, 11292, 11293, 11303, 11308, 11313, 11314, 11315, 11316, 11321, 11322, 11323, 11328, 11348, 11357, 11395, 11396, 11408, 11409, 11410, 11411, 11419, 11420, 11441, 11452, 11453, 11458, 11459, 11460, 11463, 11464, 11465, 11466, 11474, 11484, 11486, 11487, 11489, 11490, 11494, 11496, 11500, 11501, 11502, 11504, 11505, 11510, 11511, 11512, 11513, 11514, 11517, 11518, 11519, 11521, 11522, 11523, 11524, 11525, 11528, 11529, 11530, 11531, 11532, 11533, 11534, 11536, 11537, 11540, 11542, 11544, 11545, 11546, 11547, 11548, 11549, 11550, 11551, 11552, 11556, 11558, 11559, 11560, 11561, 11563, 11568, 11569, 11570, 11571, 11574, 11575, 11577, 11579, 11583, 11584, 11589, 11592, 11594, 11600, 11601, 11602, 11603, 11604, 11605, 11606, 11607, 11608, 11609, 11610, 11612, 11613, 11614, 11615, 11616, 11621, 11623, 11624, 11626, 11629, 11630, 11631, 11633, 11634, 11635, 11636, 11639, 11640, 11641, 11642, 11648, 11659, 11660, 11667, 11670, 11671, 11672, 11685, 11687, 11688, 11701, 11705, 11707, 11709, 11710, 11711, 11712, 11713, 11714, 11715, 11716, 11717, 11722, 11724, 11725, 11729, 11730, 11735, 11736, 11737, 11738, 11739, 11741, 11742, 11743}
  21. // var idsStr []string
  22. // for _, id := range ids {
  23. // idsStr = append(idsStr, strconv.Itoa(id))
  24. // }
  25. // query := map[string]interface{}{
  26. // "query": map[string]interface{}{
  27. // "bool": map[string]interface{}{
  28. // "must": []map[string]interface{}{
  29. // {"match": map[string]interface{}{"source": "ETA"}},
  30. // },
  31. // "must_not": []map[string]interface{}{
  32. // {"terms": map[string]interface{}{"_id": idsStr}},
  33. // },
  34. // },
  35. // },
  36. // }
  37. // elastic().Delete("ht_test_report_v1", query)
  38. // h.SuccessResult("success", nil, result)
  39. // return
  40. // })
  41. //}