本文整理匯總了Java中org.elasticsearch.search.aggregations.Aggregations.asList方法的典型用法代碼示例。如果您正苦於以下問題:Java Aggregations.asList方法的具體用法?Java Aggregations.asList怎麽用?Java Aggregations.asList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.elasticsearch.search.aggregations.Aggregations
的用法示例。
在下文中一共展示了Aggregations.asList方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: fillHeaderAndCreateLineForNumericAggregations
import org.elasticsearch.search.aggregations.Aggregations; //導入方法依賴的package包/類
private List<String> fillHeaderAndCreateLineForNumericAggregations(Aggregations aggregations, List<String> header) throws CsvExtractorException {
List<String> line = new ArrayList<>();
List<Aggregation> aggregationList = aggregations.asList();
for(Aggregation aggregation : aggregationList){
handleNumericMetricAggregation(header, line, aggregation);
}
return line;
}
示例2: allNumericAggregations
import org.elasticsearch.search.aggregations.Aggregations; //導入方法依賴的package包/類
private boolean allNumericAggregations(Aggregations aggregations) {
List<Aggregation> aggregationList = aggregations.asList();
for(Aggregation aggregation : aggregationList){
if(!(aggregation instanceof NumericMetricsAggregation)){
return false;
}
}
return true;
}
示例3: fillHeaderAndCreateLineForNumericAggregations
import org.elasticsearch.search.aggregations.Aggregations; //導入方法依賴的package包/類
private List<Object> fillHeaderAndCreateLineForNumericAggregations(Aggregations aggregations, List<String> header) throws ObjectResultsExtractException {
List<Object> line = new ArrayList<>();
List<Aggregation> aggregationList = aggregations.asList();
for (Aggregation aggregation : aggregationList) {
handleNumericMetricAggregation(header, line, aggregation);
}
return line;
}
示例4: allNumericAggregations
import org.elasticsearch.search.aggregations.Aggregations; //導入方法依賴的package包/類
private boolean allNumericAggregations(Aggregations aggregations) {
List<Aggregation> aggregationList = aggregations.asList();
for (Aggregation aggregation : aggregationList) {
if (!(aggregation instanceof NumericMetricsAggregation)) {
return false;
}
}
return true;
}
示例5: handleAggregations
import org.elasticsearch.search.aggregations.Aggregations; //導入方法依賴的package包/類
private void handleAggregations(Aggregations aggregations, List<String> headers, List<List<String>> lines) throws CsvExtractorException {
if(allNumericAggregations(aggregations)){
lines.get(this.currentLineIndex).addAll(fillHeaderAndCreateLineForNumericAggregations(aggregations, headers));
return;
}
//aggregations with size one only supported when not metrics.
List<Aggregation> aggregationList = aggregations.asList();
if(aggregationList.size() > 1){
throw new CsvExtractorException("currently support only one aggregation at same level (Except for numeric metrics)");
}
Aggregation aggregation = aggregationList.get(0);
//we want to skip singleBucketAggregations (nested,reverse_nested,filters)
if(aggregation instanceof SingleBucketAggregation){
Aggregations singleBucketAggs = ((SingleBucketAggregation) aggregation).getAggregations();
handleAggregations(singleBucketAggs, headers, lines);
return;
}
if(aggregation instanceof NumericMetricsAggregation){
handleNumericMetricAggregation(headers, lines.get(currentLineIndex), aggregation);
return;
}
if(aggregation instanceof GeoBounds){
handleGeoBoundsAggregation(headers, lines, (GeoBounds) aggregation);
return;
}
if(aggregation instanceof TopHits){
//todo: handle this . it returns hits... maby back to normal?
//todo: read about this usages
// TopHits topHitsAggregation = (TopHits) aggregation;
}
if(aggregation instanceof MultiBucketsAggregation){
MultiBucketsAggregation bucketsAggregation = (MultiBucketsAggregation) aggregation;
String name = bucketsAggregation.getName();
//checking because it can comes from sub aggregation again
if(!headers.contains(name)){
headers.add(name);
}
Collection<? extends MultiBucketsAggregation.Bucket> buckets = bucketsAggregation.getBuckets();
//clone current line.
List<String> currentLine = lines.get(this.currentLineIndex);
List<String> clonedLine = new ArrayList<>(currentLine);
//call handle_Agg with current_line++
boolean firstLine = true;
for (MultiBucketsAggregation.Bucket bucket : buckets) {
//each bucket need to add new line with current line copied => except for first line
String key = bucket.getKeyAsString();
if(firstLine){
firstLine = false;
}
else {
currentLineIndex++;
currentLine = new ArrayList<String>(clonedLine);
lines.add(currentLine);
}
currentLine.add(key);
handleAggregations(bucket.getAggregations(),headers,lines);
}
}
}
示例6: handleAggregations
import org.elasticsearch.search.aggregations.Aggregations; //導入方法依賴的package包/類
private void handleAggregations(Aggregations aggregations, List<String> headers, List<List<Object>> lines) throws ObjectResultsExtractException {
if (allNumericAggregations(aggregations)) {
lines.get(this.currentLineIndex).addAll(fillHeaderAndCreateLineForNumericAggregations(aggregations, headers));
return;
}
//aggregations with size one only supported when not metrics.
List<Aggregation> aggregationList = aggregations.asList();
if (aggregationList.size() > 1) {
throw new ObjectResultsExtractException("currently support only one aggregation at same level (Except for numeric metrics)");
}
Aggregation aggregation = aggregationList.get(0);
//we want to skip singleBucketAggregations (nested,reverse_nested,filters)
if (aggregation instanceof SingleBucketAggregation) {
Aggregations singleBucketAggs = ((SingleBucketAggregation) aggregation).getAggregations();
handleAggregations(singleBucketAggs, headers, lines);
return;
}
if (aggregation instanceof NumericMetricsAggregation) {
handleNumericMetricAggregation(headers, lines.get(currentLineIndex), aggregation);
return;
}
if (aggregation instanceof GeoBounds) {
handleGeoBoundsAggregation(headers, lines, (GeoBounds) aggregation);
return;
}
if (aggregation instanceof TopHits) {
//todo: handle this . it returns hits... maby back to normal?
//todo: read about this usages
// TopHits topHitsAggregation = (TopHits) aggregation;
}
if (aggregation instanceof MultiBucketsAggregation) {
MultiBucketsAggregation bucketsAggregation = (MultiBucketsAggregation) aggregation;
String name = bucketsAggregation.getName();
//checking because it can comes from sub aggregation again
if (!headers.contains(name)) {
headers.add(name);
}
Collection<? extends MultiBucketsAggregation.Bucket> buckets = bucketsAggregation.getBuckets();
//clone current line.
List<Object> currentLine = lines.get(this.currentLineIndex);
List<Object> clonedLine = new ArrayList<>(currentLine);
//call handle_Agg with current_line++
boolean firstLine = true;
for (MultiBucketsAggregation.Bucket bucket : buckets) {
//each bucket need to add new line with current line copied => except for first line
String key = bucket.getKeyAsString();
if (firstLine) {
firstLine = false;
} else {
currentLineIndex++;
currentLine = new ArrayList<Object>(clonedLine);
lines.add(currentLine);
}
currentLine.add(key);
handleAggregations(bucket.getAggregations(), headers, lines);
}
}
}