本文整理汇总了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);
}
示例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);
}
示例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);
}
}
示例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;
}
示例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());
}