diff --git a/plugin/src/main/java/org/elasticsearch/xpack/graph/action/TransportGraphExploreAction.java b/plugin/src/main/java/org/elasticsearch/xpack/graph/action/TransportGraphExploreAction.java index 5275a01b516..ce51762d3a4 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/graph/action/TransportGraphExploreAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/graph/action/TransportGraphExploreAction.java @@ -351,7 +351,7 @@ public class TransportGraphExploreAction extends HandledTransportAction buckets = lastWaveTerms.getBuckets(); + List buckets = lastWaveTerms.getBuckets(); for (org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket lastWaveTerm : buckets) { Vertex fromVertex = getVertex(lastVr.fieldName(), lastWaveTerm.getKeyAsString()); for (int k = 0; k < currentHop.getNumberVertexRequests(); k++) { @@ -469,7 +469,7 @@ public class TransportGraphExploreAction extends HandledTransportAction buckets = lastWaveTerms.getBuckets(); + List buckets = lastWaveTerms.getBuckets(); for (org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket lastWaveTerm : buckets) { for (int k = 0; k < currentHop.getNumberVertexRequests(); k++) { VertexRequest vr = currentHop.getVertexRequest(k); @@ -676,7 +676,7 @@ public class TransportGraphExploreAction extends HandledTransportAction buckets = terms.getBuckets(); + List buckets = terms.getBuckets(); for (org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket bucket : buckets) { double signalWeight = bucket.getDocCount() / totalSignalStrength; addVertex(vr.fieldName(), bucket.getKeyAsString(), signalWeight, currentHopNumber, 0, 0); @@ -702,7 +702,7 @@ public class TransportGraphExploreAction extends HandledTransportAction buckets = terms.getBuckets(); + List buckets = terms.getBuckets(); for (org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket bucket : buckets) { totalSignalStrength += bucket.getDocCount(); } diff --git a/plugin/src/test/java/org/elasticsearch/xpack/ml/datafeed/extractor/aggregation/AggregationTestUtils.java b/plugin/src/test/java/org/elasticsearch/xpack/ml/datafeed/extractor/aggregation/AggregationTestUtils.java index 55d09a63d8b..7c6dd937bdd 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/ml/datafeed/extractor/aggregation/AggregationTestUtils.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/ml/datafeed/extractor/aggregation/AggregationTestUtils.java @@ -61,6 +61,7 @@ public final class AggregationTestUtils { return singleValue; } + @SuppressWarnings("unchecked") static Terms createTerms(String name, Term... terms) { Terms termsAgg = mock(Terms.class); when(termsAgg.getName()).thenReturn(name); @@ -79,7 +80,7 @@ public final class AggregationTestUtils { } buckets.add(bucket); } - when(termsAgg.getBuckets()).thenReturn(buckets); + when((List) termsAgg.getBuckets()).thenReturn(buckets); return termsAgg; }