Fix `metric` impl on unmapped fields.
This commit is contained in:
parent
610694446a
commit
5ae1236857
|
@ -80,7 +80,7 @@ public class AvgAggregator extends MetricsAggregator.SingleValue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double metric(long owningBucketOrd) {
|
public double metric(long owningBucketOrd) {
|
||||||
return sums.get(owningBucketOrd) / counts.get(owningBucketOrd);
|
return valuesSource == null ? Double.NaN : sums.get(owningBucketOrd) / counts.get(owningBucketOrd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class MaxAggregator extends MetricsAggregator.SingleValue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double metric(long owningBucketOrd) {
|
public double metric(long owningBucketOrd) {
|
||||||
return maxes.get(owningBucketOrd);
|
return valuesSource == null ? Double.NEGATIVE_INFINITY : maxes.get(owningBucketOrd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class MinAggregator extends MetricsAggregator.SingleValue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double metric(long owningBucketOrd) {
|
public double metric(long owningBucketOrd) {
|
||||||
return mins.get(owningBucketOrd);
|
return valuesSource == null ? Double.POSITIVE_INFINITY : mins.get(owningBucketOrd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class SumAggregator extends MetricsAggregator.SingleValue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double metric(long owningBucketOrd) {
|
public double metric(long owningBucketOrd) {
|
||||||
return sums.get(owningBucketOrd);
|
return valuesSource == null ? 0 : sums.get(owningBucketOrd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class ValueCountAggregator extends MetricsAggregator.SingleValue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double metric(long owningBucketOrd) {
|
public double metric(long owningBucketOrd) {
|
||||||
return counts.get(owningBucketOrd);
|
return valuesSource == null ? 0 : counts.get(owningBucketOrd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue