From 327ac9898d7c363a5b32557c8974e9d4964c66a5 Mon Sep 17 00:00:00 2001 From: Tanguy Leroux Date: Fri, 5 May 2017 21:27:09 +0200 Subject: [PATCH] Fix compilation errors after elastic/elasticsearch/elastic/x-pack-elasticsearch#24492 Original commit: elastic/x-pack-elasticsearch@06d0c1716546f52c80f709deabc83b77e8e01086 --- .../xpack/graph/action/TransportGraphExploreAction.java | 8 ++++---- .../extractor/aggregation/AggregationTestUtils.java | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) 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; }