Elasticsearch: Allow omitting field when metric supports inline script (#32839)
* Elasticsearch: Allow omitting field when metric supports inline script * Add tests for MetricEditor to show a None option * Add tests for useFields hook * Alerting: allow elasticsearch metrics without field
This commit is contained in:
@@ -280,8 +280,10 @@ type MetricAggregation struct {
|
||||
|
||||
// MarshalJSON returns the JSON encoding of the metric aggregation
|
||||
func (a *MetricAggregation) MarshalJSON() ([]byte, error) {
|
||||
root := map[string]interface{}{
|
||||
"field": a.Field,
|
||||
root := map[string]interface{}{}
|
||||
|
||||
if a.Field != "" {
|
||||
root["field"] = a.Field
|
||||
}
|
||||
|
||||
for k, v := range a.Settings {
|
||||
|
||||
Reference in New Issue
Block a user