fix sort metric item null reference

This commit is contained in:
liugq 2023-07-21 10:45:21 +08:00
parent 503b201eb2
commit fae481f790
1 changed files with 1 additions and 1 deletions

View File

@ -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)
}
}