当前位置: 首页>>代码示例>>Java>>正文


Java Aggregation.getClass方法代码示例

本文整理汇总了Java中org.elasticsearch.search.aggregations.Aggregation.getClass方法的典型用法代码示例。如果您正苦于以下问题:Java Aggregation.getClass方法的具体用法?Java Aggregation.getClass怎么用?Java Aggregation.getClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.search.aggregations.Aggregation的用法示例。


在下文中一共展示了Aggregation.getClass方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processFilterAgg

import org.elasticsearch.search.aggregations.Aggregation; //导入方法依赖的package包/类
/**
 * Parse an aggregation performed without grouping.
 * @param filter
 * @param rs
 * @throws SQLException
 */
private void processFilterAgg(InternalFilter filter, ESResultSet rs) throws SQLException{
	//String name = global.getName(); // we do not care about the global name for now
	List<Object> row = rs.getNewRow();
	Column count = null;
	for(Column c : rs.getHeading().columns())
		if(c.getOp() == Operation.COUNT) count = c;
	
	if(count != null){
		row.set(count.getIndex(), filter.getDocCount());
	}
	for(Aggregation agg : filter.getAggregations()){
		if(agg instanceof InternalNumericMetricsAggregation.SingleValue){
			InternalNumericMetricsAggregation.SingleValue numericAgg = 
					(InternalNumericMetricsAggregation.SingleValue)agg;
			String name =numericAgg.getName();
			Column column = rs.getHeading().getColumnByLabel(name);
			if(column == null){
				throw new SQLException("Unable to identify column for "+name);
			}
			row.set(column.getIndex(), numericAgg.value());
		}else throw new SQLException("Unable to parse aggregation of type "+agg.getClass());
	}
	rs.add(row);
}
 
开发者ID:Anchormen,项目名称:sql4es,代码行数:31,代码来源:SearchAggregationParser.java

示例2: getAggregationType

import org.elasticsearch.search.aggregations.Aggregation; //导入方法依赖的package包/类
public String getAggregationType(Aggregation aggregation) {

        Class<?> aggregationClass = aggregation.getClass();

        if (aggregationClass == null) {
            return AGGREGATION_NULL;
        }

        if ( classFinder.getClassMethods(aggregationClass) == null ) {
            return AGGREGATION_NULL;
        }

        if (classFinder.hasMethod("getBuckets", aggregationClass)) {
            return AGGREGATION_BUCKETS;
        }

        return AGGREGATION_SIMPLE;
    }
 
开发者ID:WedjaaOpen,项目名称:ElasticParser,代码行数:19,代码来源:AggregateResolver.java

示例3: covenValue

import org.elasticsearch.search.aggregations.Aggregation; //导入方法依赖的package包/类
private Object covenValue(Aggregation value) throws SqlParseException {
	if (value instanceof InternalNumericMetricsAggregation.SingleValue) {
		return ((InternalNumericMetricsAggregation.SingleValue) value).value();
	} else if (value instanceof InternalValueCount) {
		return ((InternalValueCount) value).getValue();
	} else if (value instanceof InternalTopHits) {
		return (value);
	} else if (value instanceof LongTerms) {
		return value;
	} else {
		throw new SqlParseException("unknow this agg type " + value.getClass());
	}
}
 
开发者ID:mazhou,项目名称:es-sql,代码行数:14,代码来源:SearchResult.java

示例4: handleNumericMetricAggregation

import org.elasticsearch.search.aggregations.Aggregation; //导入方法依赖的package包/类
private  void handleNumericMetricAggregation(List<String> header, List<String> line, Aggregation aggregation) throws CsvExtractorException {
    String name = aggregation.getName();

    if(aggregation instanceof NumericMetricsAggregation.SingleValue){
        if(!header.contains(name)){
            header.add(name);
        }
        line.add(((NumericMetricsAggregation.SingleValue) aggregation).getValueAsString());
    }
    //todo:Numeric MultiValue - Stats,ExtendedStats,Percentile...
    else if(aggregation instanceof NumericMetricsAggregation.MultiValue){
        if(aggregation instanceof Stats) {
            String[] statsHeaders = new String[]{"count", "sum", "avg", "min", "max"};
            boolean isExtendedStats = aggregation instanceof ExtendedStats;
            if(isExtendedStats){
                String[] extendedHeaders = new String[]{"sumOfSquares", "variance", "stdDeviation"};
                statsHeaders = Util.concatStringsArrays(statsHeaders,extendedHeaders);
            }
            mergeHeadersWithPrefix(header, name, statsHeaders);
            Stats stats = (Stats) aggregation;
            line.add(stats.getCountAsString());
            line.add(stats.getSumAsString());
            line.add(stats.getAvgAsString());
            line.add(stats.getMinAsString());
            line.add(stats.getMaxAsString());
            if(isExtendedStats){
                ExtendedStats extendedStats = (ExtendedStats) aggregation;
                line.add(extendedStats.getSumOfSquaresAsString());
                line.add(extendedStats.getVarianceAsString());
                line.add(extendedStats.getStdDeviationAsString());
            }
        }
        else if( aggregation instanceof Percentiles){
            String[] percentileHeaders = new String[]{"1.0", "5.0", "25.0", "50.0", "75.0", "95.0", "99.0"};
            mergeHeadersWithPrefix(header, name, percentileHeaders);
            Percentiles percentiles = (Percentiles) aggregation;
            line.add(percentiles.percentileAsString(1.0));
            line.add(percentiles.percentileAsString(5.0));
            line.add(percentiles.percentileAsString(25.0));
            line.add(percentiles.percentileAsString(50.0));
            line.add(percentiles.percentileAsString(75));
            line.add(percentiles.percentileAsString(95.0));
            line.add(percentiles.percentileAsString(99.0));
        }
        else {
            throw new CsvExtractorException("unknown NumericMetricsAggregation.MultiValue:" + aggregation.getClass());
        }

    }
    else {
        throw new CsvExtractorException("unknown NumericMetricsAggregation" + aggregation.getClass());
    }
}
 
开发者ID:mazhou,项目名称:es-sql,代码行数:54,代码来源:CSVResultsExtractor.java

示例5: handleNumericMetricAggregation

import org.elasticsearch.search.aggregations.Aggregation; //导入方法依赖的package包/类
private void handleNumericMetricAggregation(List<String> header, List<Object> line, Aggregation aggregation) throws ObjectResultsExtractException {
    String name = aggregation.getName();

    if (aggregation instanceof NumericMetricsAggregation.SingleValue) {
        if (!header.contains(name)) {
            header.add(name);
        }
        line.add(((NumericMetricsAggregation.SingleValue) aggregation).value());
    }
    //todo:Numeric MultiValue - Stats,ExtendedStats,Percentile...
    else if (aggregation instanceof NumericMetricsAggregation.MultiValue) {
        if (aggregation instanceof Stats) {
            String[] statsHeaders = new String[]{"count", "sum", "avg", "min", "max"};
            boolean isExtendedStats = aggregation instanceof ExtendedStats;
            if (isExtendedStats) {
                String[] extendedHeaders = new String[]{"sumOfSquares", "variance", "stdDeviation"};
                statsHeaders = Util.concatStringsArrays(statsHeaders, extendedHeaders);
            }
            mergeHeadersWithPrefix(header, name, statsHeaders);
            Stats stats = (Stats) aggregation;
            line.add(stats.getCount());
            line.add(stats.getSum());
            line.add(stats.getAvg());
            line.add(stats.getMin());
            line.add(stats.getMax());
            if (isExtendedStats) {
                ExtendedStats extendedStats = (ExtendedStats) aggregation;
                line.add(extendedStats.getSumOfSquares());
                line.add(extendedStats.getVariance());
                line.add(extendedStats.getStdDeviation());
            }
        } else if (aggregation instanceof Percentiles) {
            String[] percentileHeaders = new String[]{"1.0", "5.0", "25.0", "50.0", "75.0", "95.0", "99.0"};
            mergeHeadersWithPrefix(header, name, percentileHeaders);
            Percentiles percentiles = (Percentiles) aggregation;
            line.add(percentiles.percentile(1.0));
            line.add(percentiles.percentile(5.0));
            line.add(percentiles.percentile(25.0));
            line.add(percentiles.percentile(50.0));
            line.add(percentiles.percentile(75));
            line.add(percentiles.percentile(95.0));
            line.add(percentiles.percentile(99.0));
        } else {
            throw new ObjectResultsExtractException("unknown NumericMetricsAggregation.MultiValue:" + aggregation.getClass());
        }

    } else {
        throw new ObjectResultsExtractException("unknown NumericMetricsAggregation" + aggregation.getClass());
    }
}
 
开发者ID:mazhou,项目名称:es-sql,代码行数:51,代码来源:ObjectResultsExtractor.java

示例6: handleNumericMetricAggregation

import org.elasticsearch.search.aggregations.Aggregation; //导入方法依赖的package包/类
private  void handleNumericMetricAggregation(List<String> header, List<String> line, Aggregation aggregation) throws CsvExtractorException {
    String name = aggregation.getName();

    if(aggregation instanceof NumericMetricsAggregation.SingleValue){
        if(!header.contains(name)){
            header.add(name);
        }
        NumericMetricsAggregation.SingleValue agg = (NumericMetricsAggregation.SingleValue) aggregation;
        line.add(!Double.isInfinite(agg.value()) ? agg.getValueAsString() : "null");
    }
    //todo:Numeric MultiValue - Stats,ExtendedStats,Percentile...
    else if(aggregation instanceof NumericMetricsAggregation.MultiValue){
        if(aggregation instanceof Stats) {
            String[] statsHeaders = new String[]{"count", "sum", "avg", "min", "max"};
            boolean isExtendedStats = aggregation instanceof ExtendedStats;
            if(isExtendedStats){
                String[] extendedHeaders = new String[]{"sumOfSquares", "variance", "stdDeviation"};
                statsHeaders = Util.concatStringsArrays(statsHeaders,extendedHeaders);
            }
            mergeHeadersWithPrefix(header, name, statsHeaders);
            Stats stats = (Stats) aggregation;
            line.add(String.valueOf(stats.getCount()));
            line.add(stats.getSumAsString());
            line.add(stats.getAvgAsString());
            line.add(stats.getMinAsString());
            line.add(stats.getMaxAsString());
            if(isExtendedStats){
                ExtendedStats extendedStats = (ExtendedStats) aggregation;
                line.add(extendedStats.getSumOfSquaresAsString());
                line.add(extendedStats.getVarianceAsString());
                line.add(extendedStats.getStdDeviationAsString());
            }
        }
        else if( aggregation instanceof Percentiles){
            String[] percentileHeaders = new String[]{"1.0", "5.0", "25.0", "50.0", "75.0", "95.0", "99.0"};
            mergeHeadersWithPrefix(header, name, percentileHeaders);
            Percentiles percentiles = (Percentiles) aggregation;
            line.add(percentiles.percentileAsString(1.0));
            line.add(percentiles.percentileAsString(5.0));
            line.add(percentiles.percentileAsString(25.0));
            line.add(percentiles.percentileAsString(50.0));
            line.add(percentiles.percentileAsString(75));
            line.add(percentiles.percentileAsString(95.0));
            line.add(percentiles.percentileAsString(99.0));
        }
        else {
            throw new CsvExtractorException("unknown NumericMetricsAggregation.MultiValue:" + aggregation.getClass());
        }

    }
    else {
        throw new CsvExtractorException("unknown NumericMetricsAggregation" + aggregation.getClass());
    }
}
 
开发者ID:NLPchina,项目名称:elasticsearch-sql,代码行数:55,代码来源:CSVResultsExtractor.java

示例7: getAggregationClass

import org.elasticsearch.search.aggregations.Aggregation; //导入方法依赖的package包/类
private Class<?> getAggregationClass(Aggregation aggregation) {
	return aggregation.getClass();
}
 
开发者ID:WedjaaOpen,项目名称:ElasticParser,代码行数:4,代码来源:AggregateResolver.java


注:本文中的org.elasticsearch.search.aggregations.Aggregation.getClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。