Permalink
Browse files

Fixed sampling with aggregation spout in ES5

  • Loading branch information...
jnioche committed Feb 24, 2017
1 parent 8d6466b commit c5a04d8c8e8639a92bf8f3079fd3e2ec4a07b9cf
@@ -37,6 +37,7 @@
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.aggregations.AggregationBuilders;
import org.elasticsearch.search.aggregations.Aggregations;
import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregation;
import org.elasticsearch.search.aggregations.bucket.sampler.SamplerAggregationBuilder;
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
@@ -235,6 +236,11 @@ public void onResponse(SearchResponse response) {
Aggregations aggregs = response.getAggregations();
SingleBucketAggregation sample = aggregs.get("sample");
if (sample != null) {
aggregs = sample.getAggregations();
}
Terms agg = aggregs.get("partition");
int numhits = 0;

0 comments on commit c5a04d8

Please sign in to comment.