1234567891011121314151617181920 |
- package elasticsearch
- import (
- elastic "app.yhyue.com/moapp/jybase/es"
- esV7 "github.com/olivere/elastic/v7"
- )
- // GetAggs 聚合查询
- func GetAggs(index, itype, query string) esV7.Aggregations {
- v1, _, _ := elastic.GetAggs(index, itype, query)
- return v1
- }
- func GetAggsWithCount(index, itype, query string) (esV7.Aggregations, int64) {
- if len(query) > 0 {
- query = `{"track_total_hits": true,` + query[1:]
- }
- v1, v2, _ := elastic.GetAggs(index, itype, query)
- return v1, v2
- }
|