Skip to content

Commit fdc674a

Browse files
committed
Remove abstract InternalMetricsAggregation class (#23326)
This class doesn't seem to do much other than to group together certain types of aggregations.
1 parent 2a745d2 commit fdc674a

File tree

7 files changed

+14
-63
lines changed

7 files changed

+14
-63
lines changed

core/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalMetricsAggregation.java

Lines changed: 0 additions & 42 deletions
This file was deleted.

core/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalNumericMetricsAggregation.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,14 @@
2020

2121
import org.elasticsearch.common.io.stream.StreamInput;
2222
import org.elasticsearch.search.DocValueFormat;
23+
import org.elasticsearch.search.aggregations.InternalAggregation;
2324
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
2425

2526
import java.io.IOException;
2627
import java.util.List;
2728
import java.util.Map;
2829

29-
/**
30-
*
31-
*/
32-
public abstract class InternalNumericMetricsAggregation extends InternalMetricsAggregation {
30+
public abstract class InternalNumericMetricsAggregation extends InternalAggregation {
3331

3432
private static final DocValueFormat DEFAULT_FORMAT = DocValueFormat.RAW;
3533

core/src/main/java/org/elasticsearch/search/aggregations/metrics/geobounds/InternalGeoBounds.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,13 @@
2424
import org.elasticsearch.common.io.stream.StreamOutput;
2525
import org.elasticsearch.common.xcontent.XContentBuilder;
2626
import org.elasticsearch.search.aggregations.InternalAggregation;
27-
import org.elasticsearch.search.aggregations.metrics.InternalMetricsAggregation;
2827
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
2928

3029
import java.io.IOException;
3130
import java.util.List;
3231
import java.util.Map;
3332

34-
public class InternalGeoBounds extends InternalMetricsAggregation implements GeoBounds {
33+
public class InternalGeoBounds extends InternalAggregation implements GeoBounds {
3534
private final double top;
3635
private final double bottom;
3736
private final double posLeft;
@@ -82,7 +81,7 @@ protected void doWriteTo(StreamOutput out) throws IOException {
8281
public String getWriteableName() {
8382
return GeoBoundsAggregationBuilder.NAME;
8483
}
85-
84+
8685
@Override
8786
public InternalAggregation doReduce(List<InternalAggregation> aggregations, ReduceContext reduceContext) {
8887
double top = Double.NEGATIVE_INFINITY;
@@ -187,21 +186,21 @@ public XContentBuilder doXContentBody(XContentBuilder builder, Params params) th
187186
private static class BoundingBox {
188187
private final GeoPoint topLeft;
189188
private final GeoPoint bottomRight;
190-
189+
191190
BoundingBox(GeoPoint topLeft, GeoPoint bottomRight) {
192191
this.topLeft = topLeft;
193192
this.bottomRight = bottomRight;
194193
}
195-
194+
196195
public GeoPoint topLeft() {
197196
return topLeft;
198197
}
199-
198+
200199
public GeoPoint bottomRight() {
201200
return bottomRight;
202201
}
203202
}
204-
203+
205204
private BoundingBox resolveBoundingBox() {
206205
if (Double.isInfinite(top)) {
207206
return null;

core/src/main/java/org/elasticsearch/search/aggregations/metrics/geocentroid/InternalGeoCentroid.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.elasticsearch.common.io.stream.StreamOutput;
2626
import org.elasticsearch.common.xcontent.XContentBuilder;
2727
import org.elasticsearch.search.aggregations.InternalAggregation;
28-
import org.elasticsearch.search.aggregations.metrics.InternalMetricsAggregation;
2928
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
3029

3130
import java.io.IOException;
@@ -35,7 +34,7 @@
3534
/**
3635
* Serialization and merge logic for {@link GeoCentroidAggregator}.
3736
*/
38-
public class InternalGeoCentroid extends InternalMetricsAggregation implements GeoCentroid {
37+
public class InternalGeoCentroid extends InternalAggregation implements GeoCentroid {
3938
protected final GeoPoint centroid;
4039
protected final long count;
4140

core/src/main/java/org/elasticsearch/search/aggregations/metrics/scripted/InternalScriptedMetric.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import org.elasticsearch.script.Script;
2828
import org.elasticsearch.script.ScriptContext;
2929
import org.elasticsearch.search.aggregations.InternalAggregation;
30-
import org.elasticsearch.search.aggregations.metrics.InternalMetricsAggregation;
3130
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
3231

3332
import java.io.IOException;
@@ -37,7 +36,7 @@
3736
import java.util.List;
3837
import java.util.Map;
3938

40-
public class InternalScriptedMetric extends InternalMetricsAggregation implements ScriptedMetric {
39+
public class InternalScriptedMetric extends InternalAggregation implements ScriptedMetric {
4140
private final Script reduceScript;
4241
private final List<Object> aggregation;
4342

core/src/main/java/org/elasticsearch/search/aggregations/metrics/tophits/InternalTopHits.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@
2626
import org.elasticsearch.common.io.stream.StreamOutput;
2727
import org.elasticsearch.common.lucene.Lucene;
2828
import org.elasticsearch.common.xcontent.XContentBuilder;
29+
import org.elasticsearch.search.SearchHit;
2930
import org.elasticsearch.search.SearchHits;
3031
import org.elasticsearch.search.aggregations.InternalAggregation;
31-
import org.elasticsearch.search.aggregations.metrics.InternalMetricsAggregation;
3232
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
33-
import org.elasticsearch.search.SearchHit;
3433

3534
import java.io.IOException;
3635
import java.util.List;
@@ -39,7 +38,7 @@
3938
/**
4039
* Results of the {@link TopHitsAggregator}.
4140
*/
42-
public class InternalTopHits extends InternalMetricsAggregation implements TopHits {
41+
public class InternalTopHits extends InternalAggregation implements TopHits {
4342
private int from;
4443
private int size;
4544
private TopDocs topDocs;
@@ -107,7 +106,7 @@ public InternalAggregation doReduce(List<InternalAggregation> aggregations, Redu
107106
shardDocs = new TopFieldDocs[aggregations.size()];
108107
for (int i = 0; i < shardDocs.length; i++) {
109108
InternalTopHits topHitsAgg = (InternalTopHits) aggregations.get(i);
110-
shardDocs[i] = (TopFieldDocs) topHitsAgg.topDocs;
109+
shardDocs[i] = topHitsAgg.topDocs;
111110
shardHits[i] = topHitsAgg.searchHits;
112111
}
113112
reducedTopDocs = TopDocs.merge(sort, from, size, (TopFieldDocs[]) shardDocs);

modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/InternalMatrixStats.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import org.elasticsearch.common.io.stream.StreamOutput;
2323
import org.elasticsearch.common.xcontent.XContentBuilder;
2424
import org.elasticsearch.search.aggregations.InternalAggregation;
25-
import org.elasticsearch.search.aggregations.metrics.InternalMetricsAggregation;
2625
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
2726

2827
import java.io.IOException;
@@ -35,7 +34,7 @@
3534
/**
3635
* Computes distribution statistics over multiple fields
3736
*/
38-
public class InternalMatrixStats extends InternalMetricsAggregation implements MatrixStats {
37+
public class InternalMatrixStats extends InternalAggregation implements MatrixStats {
3938
/** per shard stats needed to compute stats */
4039
private final RunningStats stats;
4140
/** final result */

0 commit comments

Comments
 (0)