Fix compilation errors after elastic/elasticsearch/elastic/x-pack-elasticsearch#24492

Original commit: elastic/x-pack-elasticsearch@06d0c17165
This commit is contained in:
Tanguy Leroux 2017-05-05 21:27:09 +02:00
parent 30c616a232
commit 327ac9898d
2 changed files with 6 additions and 5 deletions

View File

@ -351,7 +351,7 @@ public class TransportGraphExploreAction extends HandledTransportAction<GraphExp
// There were no terms from the previous phase that needed pursuing // There were no terms from the previous phase that needed pursuing
continue; continue;
} }
List<org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket> buckets = lastWaveTerms.getBuckets(); List<? extends Terms.Bucket> buckets = lastWaveTerms.getBuckets();
for (org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket lastWaveTerm : buckets) { for (org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket lastWaveTerm : buckets) {
Vertex fromVertex = getVertex(lastVr.fieldName(), lastWaveTerm.getKeyAsString()); Vertex fromVertex = getVertex(lastVr.fieldName(), lastWaveTerm.getKeyAsString());
for (int k = 0; k < currentHop.getNumberVertexRequests(); k++) { for (int k = 0; k < currentHop.getNumberVertexRequests(); k++) {
@ -469,7 +469,7 @@ public class TransportGraphExploreAction extends HandledTransportAction<GraphExp
if (lastWaveTerms == null) { if (lastWaveTerms == null) {
continue; continue;
} }
List<org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket> buckets = lastWaveTerms.getBuckets(); List<? extends Terms.Bucket> buckets = lastWaveTerms.getBuckets();
for (org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket lastWaveTerm : buckets) { for (org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket lastWaveTerm : buckets) {
for (int k = 0; k < currentHop.getNumberVertexRequests(); k++) { for (int k = 0; k < currentHop.getNumberVertexRequests(); k++) {
VertexRequest vr = currentHop.getVertexRequest(k); VertexRequest vr = currentHop.getVertexRequest(k);
@ -676,7 +676,7 @@ public class TransportGraphExploreAction extends HandledTransportAction<GraphExp
} }
} else { } else {
Terms terms = sample.getAggregations().get("field" + j); Terms terms = sample.getAggregations().get("field" + j);
List<org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
for (org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket bucket : buckets) { for (org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket bucket : buckets) {
double signalWeight = bucket.getDocCount() / totalSignalStrength; double signalWeight = bucket.getDocCount() / totalSignalStrength;
addVertex(vr.fieldName(), bucket.getKeyAsString(), signalWeight, currentHopNumber, 0, 0); addVertex(vr.fieldName(), bucket.getKeyAsString(), signalWeight, currentHopNumber, 0, 0);
@ -702,7 +702,7 @@ public class TransportGraphExploreAction extends HandledTransportAction<GraphExp
} else { } else {
// Signal is based on popularity (number of documents) // Signal is based on popularity (number of documents)
Terms terms = sample.getAggregations().get("field" + i); Terms terms = sample.getAggregations().get("field" + i);
List<org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
for (org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket bucket : buckets) { for (org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket bucket : buckets) {
totalSignalStrength += bucket.getDocCount(); totalSignalStrength += bucket.getDocCount();
} }

View File

@ -61,6 +61,7 @@ public final class AggregationTestUtils {
return singleValue; return singleValue;
} }
@SuppressWarnings("unchecked")
static Terms createTerms(String name, Term... terms) { static Terms createTerms(String name, Term... terms) {
Terms termsAgg = mock(Terms.class); Terms termsAgg = mock(Terms.class);
when(termsAgg.getName()).thenReturn(name); when(termsAgg.getName()).thenReturn(name);
@ -79,7 +80,7 @@ public final class AggregationTestUtils {
} }
buckets.add(bucket); buckets.add(bucket);
} }
when(termsAgg.getBuckets()).thenReturn(buckets); when((List<Terms.Bucket>) termsAgg.getBuckets()).thenReturn(buckets);
return termsAgg; return termsAgg;
} }