diff --git a/zipkin-storage/elasticsearch/src/main/java/zipkin/storage/elasticsearch/ElasticsearchSpanStore.java b/zipkin-storage/elasticsearch/src/main/java/zipkin/storage/elasticsearch/ElasticsearchSpanStore.java index a5e978eb763..5ff4a04d797 100755 --- a/zipkin-storage/elasticsearch/src/main/java/zipkin/storage/elasticsearch/ElasticsearchSpanStore.java +++ b/zipkin-storage/elasticsearch/src/main/java/zipkin/storage/elasticsearch/ElasticsearchSpanStore.java @@ -148,11 +148,7 @@ public int compare(List left, List right) { return transform(traceIds, new AsyncFunction, List>>() { @Override public ListenableFuture>> apply(List input) { - List traceIds = new ArrayList<>(input.size()); - for (String bucket : input) { - traceIds.add(Util.lowerHexToUnsignedLong(bucket)); - } - return getTracesByIds(traceIds, indices); + return getTracesByIds(input, indices); } } ); @@ -170,12 +166,8 @@ public int compare(List left, List right) { return client.findSpans(catchAll, termQuery("traceId", Util.toLowerHex(traceId))); } - ListenableFuture>> getTracesByIds(Collection traceIds, String[] indices) { - List traceIdsStr = new ArrayList<>(traceIds.size()); - for (long traceId : traceIds) { - traceIdsStr.add(Util.toLowerHex(traceId)); - } - return Futures.transform(client.findSpans(indices, termsQuery("traceId", traceIdsStr)), + ListenableFuture>> getTracesByIds(Collection traceIds, String[] indices) { + return Futures.transform(client.findSpans(indices, termsQuery("traceId", traceIds)), ConvertTracesResponse.INSTANCE); } @@ -202,12 +194,12 @@ enum ConvertTracesResponse implements Function, List>> { .path("annotations") .subAggregation(AggregationBuilders.terms("annotationsServiceName_agg") .field("annotations.endpoint.serviceName") - .size(0)), + .size(Integer.MAX_VALUE)), AggregationBuilders.nested("binaryAnnotations_agg") .path("binaryAnnotations") .subAggregation(AggregationBuilders.terms("binaryAnnotationsServiceName_agg") .field("binaryAnnotations.endpoint.serviceName") - .size(0))); + .size(Integer.MAX_VALUE))); } @Override public ListenableFuture> getSpanNames(String serviceName) { @@ -227,7 +219,7 @@ enum ConvertTracesResponse implements Function, List>> { AggregationBuilders.terms("name_agg") .order(Order.term(true)) .field("name") - .size(0)); + .size(Integer.MAX_VALUE)); } @Override public ListenableFuture> getDependencies(long endMillis,