diff --git a/model/insight/metric_data.go b/model/insight/metric_data.go index fcc6e37b..bad438b5 100644 --- a/model/insight/metric_data.go +++ b/model/insight/metric_data.go @@ -85,7 +85,7 @@ func (m *Metric) ValidateSortKey() error { if v, ok := mm[sortItem.Key]; !ok && !util.StringInArray([]string{"_key", "_count"}, sortItem.Key){ return fmt.Errorf("unknown sort key [%s]", sortItem.Key) }else{ - if v.Statistic == "derivative" { + if v != nil && v.Statistic == "derivative" { return fmt.Errorf("can not sort by pipeline agg [%s]", v.Statistic) } }