Commit 38906acd by Marcus Efraimsson

elasticsearch: sort bucket keys to fix issue wth response parser tests

parent 49d92354
...@@ -113,15 +113,22 @@ func (rp *responseParser) processBuckets(aggs map[string]interface{}, target *Qu ...@@ -113,15 +113,22 @@ func (rp *responseParser) processBuckets(aggs map[string]interface{}, target *Qu
} }
} }
for k, v := range esAgg.Get("buckets").MustMap() { buckets := esAgg.Get("buckets").MustMap()
bucket := simplejson.NewFromAny(v) bucketKeys := make([]string, 0)
for k := range buckets {
bucketKeys = append(bucketKeys, k)
}
sort.Strings(bucketKeys)
for _, bucketKey := range bucketKeys {
bucket := simplejson.NewFromAny(buckets[bucketKey])
newProps := make(map[string]string, 0) newProps := make(map[string]string, 0)
for k, v := range props { for k, v := range props {
newProps[k] = v newProps[k] = v
} }
newProps["filter"] = k newProps["filter"] = bucketKey
err = rp.processBuckets(bucket.MustMap(), target, series, table, newProps, depth+1) err = rp.processBuckets(bucket.MustMap(), target, series, table, newProps, depth+1)
if err != nil { if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment