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


Java ExtendedStats.getCount方法代码示例

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


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

示例1: reduceStatisticsResults

import org.elasticsearch.search.aggregations.metrics.stats.extended.ExtendedStats; //导入方法依赖的package包/类
private static StatisticsResult reduceStatisticsResults(List<Aggregation> aggs) {
    List<StatisticsResult> results = new ArrayList<>();
    for (Aggregation agg : aggs) {
        if (agg instanceof ExtendedStats) {
            ExtendedStats extendedStats = (ExtendedStats) agg;
            long count = extendedStats.getCount();
            double sum = extendedStats.getSum();
            double min = extendedStats.getMin();
            double max = extendedStats.getMax();
            double standardDeviation = extendedStats.getStdDeviation();
            results.add(new StatisticsResult(count, sum, min, max, standardDeviation));
        } else {
            throw new MemgraphException("Aggregation is not a statistics: " + agg.getClass().getName());
        }
    }
    return StatisticsResult.combine(results);
}
 
开发者ID:mware-solutions,项目名称:memory-graph,代码行数:18,代码来源:ElasticsearchGraphQueryIterable.java

示例2: reduceStatisticsResults

import org.elasticsearch.search.aggregations.metrics.stats.extended.ExtendedStats; //导入方法依赖的package包/类
private static StatisticsResult reduceStatisticsResults(List<Aggregation> aggs) {
    List<StatisticsResult> results = new ArrayList<>();
    for (Aggregation agg : aggs) {
        if (agg instanceof ExtendedStats) {
            ExtendedStats extendedStats = (ExtendedStats) agg;
            long count = extendedStats.getCount();
            double sum = extendedStats.getSum();
            double min = extendedStats.getMin();
            double max = extendedStats.getMax();
            double standardDeviation = extendedStats.getStdDeviation();
            results.add(new StatisticsResult(count, sum, min, max, standardDeviation));
        } else {
            throw new VertexiumException("Aggregation is not a statistics: " + agg.getClass().getName());
        }
    }
    return StatisticsResult.combine(results);
}
 
开发者ID:visallo,项目名称:vertexium,代码行数:18,代码来源:ElasticsearchGraphQueryIterable.java

示例3: parse

import org.elasticsearch.search.aggregations.metrics.stats.extended.ExtendedStats; //导入方法依赖的package包/类
@Override
public FieldMetadata parse(FieldInfo info, ExtendedStats stats, int valuesPerDocument) {
	long from = Math.round(stats.getMin());
	long to = Math.round(stats.getMax());

	String[] esPatterns = info.getJson().path(FORMAT_PROP).asText(MetadataConstants.DEFAULT_DATE_PATTERN).split(DATE_SEPARATOR);
	String pattern = jodaToJDK(info, esPatterns);
	Instant fromInstant = Instant.ofEpochMilli(from);
	Instant toInstant = Instant.ofEpochMilli(to);
	ChronoUnit unit = calculateTimeStep(fromInstant, toInstant, stats.getCount());

	if(pattern != null) {
		long increment = unit.between(fromInstant, toInstant) / stats.getCount();
		return new DateFieldMetadata(info.getFullPath(), valuesPerDocument, fromInstant, toInstant, increment, unit, pattern);
	} else {
		return jodaToNumericUnit(info.getFullPath(), valuesPerDocument, fromInstant, toInstant, unit, esPatterns);
	}
}
 
开发者ID:kucera-jan-cz,项目名称:esBench,代码行数:19,代码来源:DateStatsAnalyzer.java

示例4: collectNumericData

import org.elasticsearch.search.aggregations.metrics.stats.extended.ExtendedStats; //导入方法依赖的package包/类
private <T extends FieldMetadata> List<FieldMetadata> collectNumericData(Collection<FieldInfo> fields, ExtendedStatsAnalyzer<T> parser) {
	if(fields.isEmpty()) {
		return Collections.emptyList();
	}
	List<FieldMetadata> metadata = new ArrayList<>(fields.size());
	SearchRequestBuilder builder = createNumericSearchBuilder(fields);
	SearchResponse response = client.search(builder.request()).actionGet();
	for(FieldInfo info : fields) {
		InternalFilter filter = getAggregation(response, info, FILTER_AGG);
		ExtendedStats stats = (ExtendedStats) filter.getAggregations().get(EXTENDED_STATS_AGG + info.getFullPath());
		LOGGER.debug("Field {} total: {} MAX: {} MIN: {}", info.getFullPath(), stats.getCount(), stats.getMaxAsString(), stats.getMinAsString());
		if(stats.getCount() <= ZERO_ITEMS) {
			continue;
		}
		int valuesPerDocument = valuesPerDoc(response, filter, stats);
		FieldMetadata meta = parser.parse(info, stats, valuesPerDocument);
		LOGGER.debug("Registering metadata: {}", meta);
		metadata.add(meta);
	}
	return metadata;
}
 
开发者ID:kucera-jan-cz,项目名称:esBench,代码行数:22,代码来源:FieldAnalyzer.java

示例5: parse

import org.elasticsearch.search.aggregations.metrics.stats.extended.ExtendedStats; //导入方法依赖的package包/类
@Override
public BooleanFieldMetadata parse(FieldInfo info, ExtendedStats stats, int valuesPerDocument) {
	long total = stats.getCount();
	long trueValues = (long) stats.getSum();
	long falseValues = (long) (total - stats.getSum());
	LOGGER.info("Field {} Total: {} #tokens/doc: {} True: {} False: {}", info.getFullPath(), total, valuesPerDocument, trueValues, falseValues);
	return new BooleanFieldMetadata(info.getFullPath());
}
 
开发者ID:kucera-jan-cz,项目名称:esBench,代码行数:9,代码来源:BooleanStatsAnalyzer.java


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