Skip to content

Commit 7c44eff

Browse files
committed
Add BucketMetricValue interface (#24188)
Unlike other implementations of InternalNumericMetricsAggregation.SingleValue, the InternalBucketMetricValue aggregation currently doesn't implement a specialized interface that exposes the `keys()` method. This change adds this so that clients can access the keys via the interface.
1 parent 8562092 commit 7c44eff

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Licensed to Elasticsearch under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.elasticsearch.search.aggregations.pipeline.bucketmetrics;
21+
22+
import org.elasticsearch.search.aggregations.metrics.NumericMetricsAggregation;
23+
24+
public interface BucketMetricValue extends NumericMetricsAggregation.SingleValue {
25+
26+
String[] keys();
27+
}

core/src/main/java/org/elasticsearch/search/aggregations/pipeline/bucketmetrics/InternalBucketMetricValue.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import java.util.List;
3232
import java.util.Map;
3333

34-
public class InternalBucketMetricValue extends InternalNumericMetricsAggregation.SingleValue {
34+
public class InternalBucketMetricValue extends InternalNumericMetricsAggregation.SingleValue implements BucketMetricValue {
3535
public static final String NAME = "bucket_metric_value";
3636

3737
private double value;
@@ -72,6 +72,7 @@ public double value() {
7272
return value;
7373
}
7474

75+
@Override
7576
public String[] keys() {
7677
return keys;
7778
}

0 commit comments

Comments
 (0)