|
@@ -32,7 +32,25 @@ const (
|
|
HL_IK = `"highlight": {"pre_tags": ["` + IK_pre_tags + `"],"post_tags": ["` + IK_post_tags + `"],"fields": {%s}}`
|
|
HL_IK = `"highlight": {"pre_tags": ["` + IK_pre_tags + `"],"post_tags": ["` + IK_post_tags + `"],"fields": {%s}}`
|
|
)
|
|
)
|
|
|
|
|
|
-type Aggregations map[string]*json.RawMessage
|
|
|
|
|
|
+type Aggregations map[string]json.RawMessage
|
|
|
|
+type AggregationSingleBucket struct {
|
|
|
|
+ Aggregations
|
|
|
|
+
|
|
|
|
+ DocCount int64 // `json:"doc_count"`
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func (a Aggregations) Children(name string) (*AggregationSingleBucket, bool) {
|
|
|
|
+ if raw, found := a[name]; found {
|
|
|
|
+ agg := new(AggregationSingleBucket)
|
|
|
|
+ if raw == nil {
|
|
|
|
+ return agg, true
|
|
|
|
+ }
|
|
|
|
+ if err := json.Unmarshal(raw, agg); err == nil {
|
|
|
|
+ return agg, true
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return nil, false
|
|
|
|
+}
|
|
|
|
|
|
type Es interface {
|
|
type Es interface {
|
|
Init()
|
|
Init()
|