本文整理汇总了Java中org.elasticsearch.search.aggregations.bucket.terms.TermsBuilder.size方法的典型用法代码示例。如果您正苦于以下问题:Java TermsBuilder.size方法的具体用法?Java TermsBuilder.size怎么用?Java TermsBuilder.size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.search.aggregations.bucket.terms.TermsBuilder
的用法示例。
在下文中一共展示了TermsBuilder.size方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildAggregationQuery
import org.elasticsearch.search.aggregations.bucket.terms.TermsBuilder; //导入方法依赖的package包/类
/**
* Adds aggregations recursively
* All metric columns are added to last aggregation
* @param aggs
* @param index
* @param metrics
* @return
*/
private TermsBuilder buildAggregationQuery(List<Column> aggs, int index, QueryState state){
Column agg = aggs.get(index);
TermsBuilder result = null;
if(aggs.get(index).getOp() == Operation.NONE){
result = AggregationBuilders.terms(agg.getAggName()).field(agg.getColumn());
result.size(state.getIntProp(Utils.PROP_FETCH_SIZE, 10000));
}
if(index < aggs.size() - 1) result.subAggregation(buildAggregationQuery(aggs, index+1, state));
else addMetrics(result, state.getHeading(), true);
return result;
}
示例2: SimpleAggregationBuilder
import org.elasticsearch.search.aggregations.bucket.terms.TermsBuilder; //导入方法依赖的package包/类
public SimpleAggregationBuilder(PB parentBuilder, TermsBuilder terms, String field, Integer size) {
super(parentBuilder);
if(size!=null){
terms.size(size);
}
if(StringUtils.isNotBlank(field)){
terms.field(field);
}
terms.order(Terms.Order.count(false));//COUNT_DESC
this.aggsBuilder = terms;
}
示例3: buildAggregation
import org.elasticsearch.search.aggregations.bucket.terms.TermsBuilder; //导入方法依赖的package包/类
private AbstractAggregationBuilder buildAggregation(StatsTrendRequest request) {
DateHistogram.Interval interval = Utils.getHistogramInterval(request.getPeriod());
AbstractAggregationBuilder dateHistogramBuilder = Utils.buildDateHistogramAggregation(request.getTimestamp(), interval)
.subAggregation(Utils.buildExtendedStatsAggregation(request.getField()))
.subAggregation(Utils.buildPercentileAggregation(request.getField()));
if (CollectionUtils.isNullOrEmpty(getParameter().getNesting())) {
return dateHistogramBuilder;
}
TermsBuilder rootBuilder = null;
TermsBuilder termsBuilder = null;
for (String field : getParameter().getNesting()) {
if (null == termsBuilder) {
termsBuilder = AggregationBuilders.terms(Utils.sanitizeFieldForAggregation(field)).field(field);
} else {
TermsBuilder tempBuilder = AggregationBuilders.terms(Utils.sanitizeFieldForAggregation(field)).field(field);
termsBuilder.subAggregation(tempBuilder);
termsBuilder = tempBuilder;
}
termsBuilder.size(0);
if (null == rootBuilder) {
rootBuilder = termsBuilder;
}
}
termsBuilder.subAggregation(dateHistogramBuilder);
return rootBuilder;
}
示例4: convert
import org.elasticsearch.search.aggregations.bucket.terms.TermsBuilder; //导入方法依赖的package包/类
@Override
public AggregationBuilder convert(QueryConverter queryConverter, Aggregation aggregation) {
TermsBuilder result = terms(getName(aggregation));
addField(aggregation, result);
addScript(aggregation, result);
Integer limit = aggregation.getInteger("limit");
if (limit != null) {
result.size(limit);
}
// todo - add ordering
Terms.Order order = Terms.Order.count(false);
Sort sort = Coerce.to(aggregation.get("order"), Sort.class, null);
if (sort != null) {
boolean asc = Sort.Direction.Ascending.equals(sort.getDirection());
if (Sort.Type.Count.equals(sort.getType())) {
order = Terms.Order.count(asc);
} else if (Sort.Type.Lexical.equals(sort.getType())) {
order = Terms.Order.term(asc);
}
}
result.order(order);
addSubAggs(queryConverter, aggregation, result);
return result;
}
示例5: getFacetBuilder
import org.elasticsearch.search.aggregations.bucket.terms.TermsBuilder; //导入方法依赖的package包/类
public static AggregationBuilder getFacetBuilder(MultiValueFacet multiValueFacet) {
FacetConfiguration facetConfiguration = multiValueFacet.getFacetConfiguration();
JSONObject facetData = facetConfiguration.getData();
if (multiValueFacet.isStatic()) {
return null;
}
TermsBuilder termsFacetBuilder = AggregationBuilders.terms(facetConfiguration.getFieldName());
if (facetData.has("maxTerms")) {
termsFacetBuilder.size(facetData.getInt("maxTerms"));
}
termsFacetBuilder.field(facetConfiguration.getFieldName());
return termsFacetBuilder;
}