本文整理汇总了Java中org.elasticsearch.search.aggregations.AggregationBuilders.stats方法的典型用法代码示例。如果您正苦于以下问题:Java AggregationBuilders.stats方法的具体用法?Java AggregationBuilders.stats怎么用?Java AggregationBuilders.stats使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.search.aggregations.AggregationBuilders
的用法示例。
在下文中一共展示了AggregationBuilders.stats方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeFieldAgg
import org.elasticsearch.search.aggregations.AggregationBuilders; //导入方法依赖的package包/类
/**
* Create aggregation according to the SQL function.
*
* @param field SQL function
* @param parent parentAggregation
* @return AggregationBuilder represents the SQL function
* @throws SqlParseException in case of unrecognized function
*/
public AggregationBuilder makeFieldAgg(MethodField field, AggregationBuilder parent) throws SqlParseException {
groupMap.put(field.getAlias(), new KVValue("FIELD", parent));
ValuesSourceAggregationBuilder builder;
field.setAlias(fixAlias(field.getAlias()));
switch (field.getName().toUpperCase()) {
case "SUM":
builder = AggregationBuilders.sum(field.getAlias());
return addFieldToAgg(field, builder);
case "MAX":
builder = AggregationBuilders.max(field.getAlias());
return addFieldToAgg(field, builder);
case "MIN":
builder = AggregationBuilders.min(field.getAlias());
return addFieldToAgg(field, builder);
case "AVG":
builder = AggregationBuilders.avg(field.getAlias());
return addFieldToAgg(field, builder);
case "STATS":
builder = AggregationBuilders.stats(field.getAlias());
return addFieldToAgg(field, builder);
case "EXTENDED_STATS":
builder = AggregationBuilders.extendedStats(field.getAlias());
return addFieldToAgg(field, builder);
case "PERCENTILES":
builder = AggregationBuilders.percentiles(field.getAlias());
addSpecificPercentiles((PercentilesAggregationBuilder) builder, field.getParams());
return addFieldToAgg(field, builder);
case "TOPHITS":
return makeTopHitsAgg(field);
case "SCRIPTED_METRIC":
return scriptedMetric(field);
case "COUNT":
groupMap.put(field.getAlias(), new KVValue("COUNT", parent));
return makeCountAgg(field);
default:
throw new SqlParseException("the agg function not to define !");
}
}
示例2: makeFieldAgg
import org.elasticsearch.search.aggregations.AggregationBuilders; //导入方法依赖的package包/类
/**
* Create aggregation according to the SQL function.
*
* @param field SQL function
* @param parent parentAggregation
* @return AggregationBuilder represents the SQL function
* @throws SqlParseException in case of unrecognized function
*/
public AggregationBuilder makeFieldAgg(MethodField field, AggregationBuilder parent) throws SqlParseException {
groupMap.put(field.getAlias(), new KVValue("FIELD", parent));
ValuesSourceAggregationBuilder builder;
field.setAlias(fixAlias(field.getAlias()));
switch (field.getName().toUpperCase()) {
case "SUM":
builder = AggregationBuilders.sum(field.getAlias());
return addFieldToAgg(field, builder);
case "MAX":
builder = AggregationBuilders.max(field.getAlias());
return addFieldToAgg(field, builder);
case "MIN":
builder = AggregationBuilders.min(field.getAlias());
return addFieldToAgg(field, builder);
case "AVG":
builder = AggregationBuilders.avg(field.getAlias());
return addFieldToAgg(field, builder);
case "STATS":
builder = AggregationBuilders.stats(field.getAlias());
return addFieldToAgg(field, builder);
case "EXTENDED_STATS":
builder = AggregationBuilders.extendedStats(field.getAlias());
return addFieldToAgg(field, builder);
case "PERCENTILES":
builder = AggregationBuilders.percentiles(field.getAlias());
addSpecificPercentiles((PercentilesAggregationBuilder) builder, field.getParams());
return addFieldToAgg(field, builder);
case "TOPHITS":
return makeTopHitsAgg(field);
case "SCRIPTED_METRIC":
return scriptedMetric(field);
case "COUNT":
groupMap.put(field.getAlias(), new KVValue("COUNT", parent));
return addFieldToAgg(field, makeCountAgg(field));
default:
throw new SqlParseException("the agg function not to define !");
}
}
示例3: convert
import org.elasticsearch.search.aggregations.AggregationBuilders; //导入方法依赖的package包/类
@Override
public AbstractAggregationBuilder convert(QueryConverter queryConverter, Aggregation aggregation) {
StatsBuilder result = AggregationBuilders.stats(getName(aggregation));
String field = aggregation.getString("field");
if (field != null) {
result.field(field);
}
return result;
}
示例4: makeFieldAgg
import org.elasticsearch.search.aggregations.AggregationBuilders; //导入方法依赖的package包/类
/**
* Create aggregation according to the SQL function.
* @param field SQL function
* @param parent parentAggregation
* @return AggregationBuilder represents the SQL function
* @throws SqlParseException in case of unrecognized function
*/
public AbstractAggregationBuilder makeFieldAgg(MethodField field, AbstractAggregationBuilder parent) throws SqlParseException {
groupMap.put(field.getAlias(), new KVValue("FIELD", parent));
ValuesSourceMetricsAggregationBuilder builder;
field.setAlias(fixAlias(field.getAlias()));
switch (field.getName().toUpperCase()) {
case "SUM":
builder = AggregationBuilders.sum(field.getAlias());
addFieldOrScriptToAggregation(field, builder);
return builder;
case "MAX":
builder = AggregationBuilders.max(field.getAlias());
addFieldOrScriptToAggregation(field, builder);
return builder;
case "MIN":
builder = AggregationBuilders.min(field.getAlias());
addFieldOrScriptToAggregation(field, builder);
return builder;
case "AVG":
builder = AggregationBuilders.avg(field.getAlias());
addFieldOrScriptToAggregation(field, builder);
return builder;
case "STATS":
builder = AggregationBuilders.stats(field.getAlias());
addFieldOrScriptToAggregation(field, builder);
return builder;
case "EXTENDED_STATS":
builder = AggregationBuilders.extendedStats(field.getAlias());
addFieldOrScriptToAggregation(field, builder);
return builder;
case "PERCENTILES":
builder = AggregationBuilders.percentiles(field.getAlias());
addFieldOrScriptToAggregation(field, builder);
return builder;
case "TOPHITS":
return makeTopHitsAgg(field);
case "SCRIPTED_METRIC":
return scriptedMetric(field);
case "COUNT":
groupMap.put(field.getAlias(), new KVValue("COUNT", parent));
return makeCountAgg(field);
default:
throw new SqlParseException("the agg function not to define !");
}
}