本文整理汇总了Java中org.elasticsearch.search.aggregations.AggregationBuilders.sum方法的典型用法代码示例。如果您正苦于以下问题:Java AggregationBuilders.sum方法的具体用法?Java AggregationBuilders.sum怎么用?Java AggregationBuilders.sum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.search.aggregations.AggregationBuilders
的用法示例。
在下文中一共展示了AggregationBuilders.sum方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: exitAggregate_mapping
import org.elasticsearch.search.aggregations.AggregationBuilders; //导入方法依赖的package包/类
@Override
public void exitAggregate_mapping(EQLParser.Aggregate_mappingContext ctx) {
// TODO I don't need AggMapping
AggMapping am = new AggMapping(ctx.ID().getText(), (FunCall)getValue(ctx.funcall()));
ValuesSourceMetricsAggregationBuilder b;
switch(am.getFc().getFunName()) {
case AVG:
b = AggregationBuilders.avg(am.getId()); break;
case MAX:
b = AggregationBuilders.max(am.getId()); break;
case MIN:
b = AggregationBuilders.min(am.getId()); break;
case SUM:
b = AggregationBuilders.sum(am.getId()); break;
default:
throw new RuntimeException("Invalid function");
}
b.field(am.getFc().getField());
setValue(ctx, b);
}
示例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 makeCountAgg(field);
default:
throw new SqlParseException("the agg function not to define !");
}
}
示例3: 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 !");
}
}
示例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 !");
}
}