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


Java TermsAggregationBuilder类代码示例

本文整理汇总了Java中org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder的典型用法代码示例。如果您正苦于以下问题:Java TermsAggregationBuilder类的具体用法?Java TermsAggregationBuilder怎么用?Java TermsAggregationBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TermsAggregationBuilder类属于org.elasticsearch.search.aggregations.bucket.terms包,在下文中一共展示了TermsAggregationBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testCase

import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; //导入依赖的package包/类
private void testCase(IndexSearcher indexSearcher, MappedFieldType genreFieldType, String executionHint,
                      Consumer<InternalSampler> verify) throws IOException {
    MappedFieldType idFieldType = new KeywordFieldMapper.KeywordFieldType();
    idFieldType.setName("id");
    idFieldType.setHasDocValues(true);

    SortedNumericDVIndexFieldData fieldData = new SortedNumericDVIndexFieldData(new Index("index", "index"), "price",
            IndexNumericFieldData.NumericType.DOUBLE);
    FunctionScoreQuery query = new FunctionScoreQuery(new MatchAllDocsQuery(),
            new FieldValueFactorFunction("price", 1, FieldValueFactorFunction.Modifier.RECIPROCAL, null, fieldData));

    DiversifiedAggregationBuilder builder = new DiversifiedAggregationBuilder("_name")
            .field(genreFieldType.name())
            .executionHint(executionHint)
            .subAggregation(new TermsAggregationBuilder("terms", null).field("id"));

    InternalSampler result = search(indexSearcher, query, builder, genreFieldType, idFieldType);
    verify.accept(result);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:20,代码来源:DiversifiedSamplerTests.java

示例2: testDiversifiedSampler_noDocs

import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; //导入依赖的package包/类
public void testDiversifiedSampler_noDocs() throws Exception {
    Directory directory = newDirectory();
    RandomIndexWriter indexWriter = new RandomIndexWriter(random(), directory);
    indexWriter.close();
    IndexReader indexReader = DirectoryReader.open(directory);
    IndexSearcher indexSearcher = new IndexSearcher(indexReader);

    MappedFieldType idFieldType = new KeywordFieldMapper.KeywordFieldType();
    idFieldType.setName("id");
    idFieldType.setHasDocValues(true);

    MappedFieldType genreFieldType = new KeywordFieldMapper.KeywordFieldType();
    genreFieldType.setName("genre");
    genreFieldType.setHasDocValues(true);

    DiversifiedAggregationBuilder builder = new DiversifiedAggregationBuilder("_name")
            .field(genreFieldType.name())
            .subAggregation(new TermsAggregationBuilder("terms", null).field("id"));

    InternalSampler result = search(indexSearcher, new MatchAllDocsQuery(), builder, genreFieldType, idFieldType);
    Terms terms = result.getAggregations().get("terms");
    assertEquals(0, terms.getBuckets().size());
    indexReader.close();
    directory.close();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:26,代码来源:DiversifiedSamplerTests.java

示例3: testNestedDiversity

import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; //导入依赖的package包/类
public void testNestedDiversity() throws Exception {
    // Test multiple samples gathered under buckets made by a parent agg
    int MAX_DOCS_PER_AUTHOR = 1;
    TermsAggregationBuilder rootTerms = terms("genres").field("genre");

    DiversifiedAggregationBuilder sampleAgg = new DiversifiedAggregationBuilder("sample").shardSize(100);
    sampleAgg.field("author").maxDocsPerValue(MAX_DOCS_PER_AUTHOR).executionHint(randomExecutionHint());
    sampleAgg.subAggregation(terms("authors").field("author"));

    rootTerms.subAggregation(sampleAgg);
    SearchResponse response = client().prepareSearch("test").setSearchType(SearchType.QUERY_THEN_FETCH)
            .addAggregation(rootTerms).execute().actionGet();
    assertSearchResponse(response);
    Terms genres = response.getAggregations().get("genres");
    Collection<Bucket> genreBuckets = genres.getBuckets();
    for (Terms.Bucket genreBucket : genreBuckets) {
        Sampler sample = genreBucket.getAggregations().get("sample");
        Terms authors = sample.getAggregations().get("authors");
        Collection<Bucket> testBuckets = authors.getBuckets();

        for (Terms.Bucket testBucket : testBuckets) {
            assertThat(testBucket.getDocCount(), lessThanOrEqualTo((long) NUM_SHARDS * MAX_DOCS_PER_AUTHOR));
        }
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:26,代码来源:DiversifiedSamplerIT.java

示例4: buildGroupRequest

import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; //导入依赖的package包/类
/**
 * Builds a group search request.
 * @param groupRequest The Metron group request.
 * @param queryBuilder The search query.
 * @return An Elasticsearch search request.
 */
private org.elasticsearch.action.search.SearchRequest buildGroupRequest(
        GroupRequest groupRequest,
        QueryBuilder queryBuilder) {

  // handle groups
  TermsAggregationBuilder groups = getGroupsTermBuilder(groupRequest, 0);
  final SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder()
          .query(queryBuilder)
          .aggregation(groups);

  // return the search request
  String[] indices = wildcardIndices(groupRequest.getIndices());
  return new org.elasticsearch.action.search.SearchRequest()
          .indices(indices)
          .source(searchSourceBuilder);
}
 
开发者ID:apache,项目名称:metron,代码行数:23,代码来源:ElasticsearchDao.java

示例5: getGroupsTermBuilder

import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; //导入依赖的package包/类
private TermsAggregationBuilder getGroupsTermBuilder(GroupRequest groupRequest, int index) {
  List<Group> groups = groupRequest.getGroups();
  Group group = groups.get(index);
  String aggregationName = getGroupByAggregationName(group.getField());
  TermsAggregationBuilder termsBuilder = AggregationBuilders.terms(aggregationName);
  termsBuilder
      .field(group.getField())
      .size(accessConfig.getMaxSearchGroups())
      .order(getElasticsearchGroupOrder(group.getOrder()));
  if (index < groups.size() - 1) {
    termsBuilder.subAggregation(getGroupsTermBuilder(groupRequest, index + 1));
  }
  Optional<String> scoreField = groupRequest.getScoreField();
  if (scoreField.isPresent()) {
    SumAggregationBuilder scoreSumAggregationBuilder = AggregationBuilders.sum(getSumAggregationName(scoreField.get())).field(scoreField.get()).missing(0);
    termsBuilder.subAggregation(scoreSumAggregationBuilder);
  }
  return termsBuilder;
}
 
开发者ID:apache,项目名称:metron,代码行数:20,代码来源:ElasticsearchDao.java

示例6: buildSearchRequest

import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; //导入依赖的package包/类
/**
 * Builds an Elasticsearch search request.
 * @param searchRequest The Metron search request.
 * @param queryBuilder
 * @return An Elasticsearch search request.
 */
private org.elasticsearch.action.search.SearchRequest buildSearchRequest(
        SearchRequest searchRequest,
        QueryBuilder queryBuilder) throws InvalidSearchException {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Got search request; request={}", ElasticsearchUtils.toJSON(searchRequest).orElse("???"));
  }
  SearchSourceBuilder searchBuilder = new SearchSourceBuilder()
          .size(searchRequest.getSize())
          .from(searchRequest.getFrom())
          .query(queryBuilder)
          .trackScores(true);
  Optional<List<String>> fields = searchRequest.getFields();
  // column metadata needed to understand the type of each sort field
  Map<String, FieldType> meta;
  try {
    meta = getColumnMetadata(searchRequest.getIndices());
  } catch(IOException e) {
    throw new InvalidSearchException("Unable to get column metadata", e);
  }

  // handle sort fields
  for(SortField sortField : searchRequest.getSort()) {

    // what type is the sort field?
    FieldType sortFieldType = meta.getOrDefault(sortField.getField(), FieldType.OTHER);

    // sort order - if ascending missing values sorted last. otherwise, missing values sorted first
    org.elasticsearch.search.sort.SortOrder sortOrder = getElasticsearchSortOrder(sortField.getSortOrder());
    String missingSortOrder;
    if(sortOrder == org.elasticsearch.search.sort.SortOrder.DESC) {
      missingSortOrder = SORT_MISSING_LAST;
    } else {
      missingSortOrder = SORT_MISSING_FIRST;
    }

    // sort by the field - missing fields always last
    FieldSortBuilder sortBy = new FieldSortBuilder(sortField.getField())
            .order(sortOrder)
            .missing(missingSortOrder)
            .unmappedType(sortFieldType.getFieldType());
    searchBuilder.sort(sortBy);
  }

  // handle search fields
  if (fields.isPresent()) {
    searchBuilder.fetchSource("*", null);
  } else {
    searchBuilder.fetchSource(true);
  }

  Optional<List<String>> facetFields = searchRequest.getFacetFields();

  // handle facet fields
  if (searchRequest.getFacetFields().isPresent()) {
    // https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/_bucket_aggregations.html
    for(String field : searchRequest.getFacetFields().get()) {
      String name = getFacetAggregationName(field);
      TermsAggregationBuilder terms = AggregationBuilders.terms( name).field(field);
             // new TermsBuilder(name).field(field);
      searchBuilder.aggregation(terms);
    }
  }

  // return the search request
  String[] indices = wildcardIndices(searchRequest.getIndices());
  if (LOG.isDebugEnabled()) {
    LOG.debug("Built Elasticsearch request; indices={}, request={}", indices, searchBuilder.toString());
  }
  return new org.elasticsearch.action.search.SearchRequest()
          .indices(indices)
          .source(searchBuilder);
}
 
开发者ID:apache,项目名称:metron,代码行数:79,代码来源:ElasticsearchDao.java

示例7: doXContentBody

import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; //导入依赖的package包/类
@Override
protected XContentBuilder doXContentBody(XContentBuilder builder, Params params) throws IOException {
    bucketCountThresholds.toXContent(builder, params);
    if (executionHint != null) {
        builder.field(TermsAggregationBuilder.EXECUTION_HINT_FIELD_NAME.getPreferredName(), executionHint);
    }
    if (filterBuilder != null) {
        builder.field(BACKGROUND_FILTER.getPreferredName(), filterBuilder);
    }
    if (includeExclude != null) {
        includeExclude.toXContent(builder, params);
    }
    significanceHeuristic.toXContent(builder, params);
    return builder;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:16,代码来源:SignificantTermsAggregationBuilder.java

示例8: setUp

import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
    super.setUp();
    aggregationParserRegistry.register(new TermsParser(), TermsAggregationBuilder.NAME);
    aggregationParserRegistry.register(new SignificantTermsParser(significanceHeuristicParserRegistry, queryRegistry),
            SignificantTermsAggregationBuilder.NAME);
}
 
开发者ID:brwe,项目名称:es-token-plugin,代码行数:8,代码来源:PrepareSpecTests.java

示例9: getVertexPropertyCountByValue

import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; //导入依赖的package包/类
@Override
public Map<Object, Long> getVertexPropertyCountByValue(Graph graph, String propertyName, Authorizations authorizations) {
    TermQueryBuilder elementTypeFilterBuilder = new TermQueryBuilder(ELEMENT_TYPE_FIELD_NAME, ElasticsearchDocumentType.VERTEX.getKey());
    BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery()
            .must(QueryBuilders.matchAllQuery())
            .filter(elementTypeFilterBuilder);
    SearchRequestBuilder q = getClient().prepareSearch(getIndexNamesAsArray(graph))
            .setQuery(queryBuilder)
            .setSize(0);

    for (String p : getAllMatchingPropertyNames(graph, propertyName, authorizations)) {
        String countAggName = "count-" + p;
        PropertyDefinition propertyDefinition = getPropertyDefinition(graph, p);
        p = p.replace(".", FIELDNAME_DOT_REPLACEMENT);
        if (propertyDefinition != null && propertyDefinition.getTextIndexHints().contains(TextIndexHint.EXACT_MATCH)) {
            p = p + EXACT_MATCH_PROPERTY_NAME_SUFFIX;
        }

        TermsAggregationBuilder countAgg = AggregationBuilders
                .terms(countAggName)
                .field(p)
                .size(500000);
        q = q.addAggregation(countAgg);
    }

    if (ElasticsearchSearchQueryBase.QUERY_LOGGER.isTraceEnabled()) {
        ElasticsearchSearchQueryBase.QUERY_LOGGER.trace("query: %s", q);
    }
    SearchResponse response = getClient().search(q.request()).actionGet();
    Map<Object, Long> results = new HashMap<>();
    for (Aggregation agg : response.getAggregations().asList()) {
        Terms propertyCountResults = (Terms) agg;
        for (Terms.Bucket propertyCountResult : propertyCountResults.getBuckets()) {
            String mapKey = ((String) propertyCountResult.getKey()).toLowerCase();
            Long previousValue = results.get(mapKey);
            if (previousValue == null) {
                previousValue = 0L;
            }
            results.put(mapKey, previousValue + propertyCountResult.getDocCount());
        }
    }
    return results;
}
 
开发者ID:mware-solutions,项目名称:memory-graph,代码行数:44,代码来源:Elasticsearch5SearchIndex.java

示例10: terms

import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; //导入依赖的package包/类
/**
 * Create a new {@link Terms} aggregation with the given name.
 */
public static TermsAggregationBuilder terms(String name) {
    return new TermsAggregationBuilder(name, null);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:7,代码来源:AggregationBuilders.java

示例11: apply

import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; //导入依赖的package包/类
@Override
TermsAggregationBuilder apply(TermsAggregationBuilder builder, String field) {
    return builder.field(field);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:MinDocCountIT.java

示例12: termsAgg

import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; //导入依赖的package包/类
private AggregationBuilder termsAgg(MethodField field) throws SqlParseException {
    String aggName = gettAggNameFromParamsOrAlias(field);
    TermsAggregationBuilder terms = AggregationBuilders.terms(aggName);
    String value = null;
    for (KVValue kv : field.getParams()) {
        value = kv.value.toString();
        switch (kv.key.toLowerCase()) {
            case "field":
                terms.field(value);
                break;
            case "size":
                terms.size(Integer.parseInt(value));
                break;
            case "shard_size":
                terms.shardSize(Integer.parseInt(value));
                break;
            case "min_doc_count":
                terms.minDocCount(Integer.parseInt(value));
                break;
            case "missing":
                terms.missing(value);
                break;
            case "order":
                if ("asc".equalsIgnoreCase(value)) {
                    terms.order(Terms.Order.term(true));
                } else if ("desc".equalsIgnoreCase(value)) {
                    terms.order(Terms.Order.term(false));
                } else {
                    throw new SqlParseException("order can only support asc/desc " + kv.toString());
                }
                break;
            case "alias":
            case "nested":
            case "reverse_nested":
            case "children":
                break;
            default:
                throw new SqlParseException("terms aggregation err or not define field " + kv.toString());
        }
    }
    return terms;
}
 
开发者ID:mazhou,项目名称:es-sql,代码行数:43,代码来源:AggMaker.java

示例13: getBucketsQueries

import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; //导入依赖的package包/类
/**
 * Get's buckets queries from {@link GroupBy} item in URL.
 *
 * @param groupBy
 *            groupBy instance
 * @param entityType
 *            entity type
 * @param pagination
 *            pagination information
 * @return list of fields
 * @throws ODataApplicationException
 *             if any error occurred
 */
protected List<AggregationBuilder> getBucketsQueries(GroupBy groupBy,
        ElasticEdmEntityType entityType, Pagination pagination)
        throws ODataApplicationException {
    int size = pagination.getSkip() + pagination.getTop();
    Map<String, Boolean> orders = pagination.getOrderBy().stream()
            .collect(toMap(Sort::getProperty, order -> order.getDirection() == Direction.ASC));
    List<String> properties = getProperties(groupBy);
    reverse(properties);

    // Last because of reverse
    String lastProperty = properties.remove(0);
    String queryField = getQueryField(lastProperty, entityType);
    TermsAggregationBuilder groupByQuery = terms(lastProperty).field(queryField).size(size)
            .shardSize(getShardSize(size));
    getMetricsAggQueries(getAggregations(groupBy.getApplyOption()))
            .forEach(groupByQuery::subAggregation);
    List<Order> queryOrders = getQueryOrders(queryField, orders);
    if (!queryOrders.isEmpty()) {
        groupByQuery.order(queryOrders);
    }

    for (String property : properties) {
        queryField = getQueryField(property, entityType);
        groupByQuery = terms(property).field(queryField).size(size)
                .subAggregation(groupByQuery);
        Boolean termOrder = orders.remove(queryField);
        if (termOrder != null) {
            groupByQuery.order(Terms.Order.term(termOrder));
        }
    }

    // Fields in $orderby are not same as $groupby fields!
    if (!orders.isEmpty()) {
        throw new ODataApplicationException(
                "Ordering only by fields in $groupby or $aggregation options is allowed.",
                HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ROOT);
    }
    // For now only one 'groupby' is supported and returned in the list
    return Arrays.asList(groupByQuery);
}
 
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:54,代码来源:BucketsAggregationsRequestCreator.java

示例14: getVertexPropertyCountByValue

import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; //导入依赖的package包/类
@Override
public Map<Object, Long> getVertexPropertyCountByValue(Graph graph, String propertyName, Authorizations authorizations) {
    TermQueryBuilder elementTypeFilterBuilder = new TermQueryBuilder(ELEMENT_TYPE_FIELD_NAME, ElasticsearchDocumentType.VERTEX.getKey());
    BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery()
            .must(QueryBuilders.matchAllQuery())
            .filter(elementTypeFilterBuilder);
    SearchRequestBuilder q = getClient().prepareSearch(getIndexNamesAsArray(graph))
            .setQuery(queryBuilder)
            .setSize(0);

    for (String p : getAllMatchingPropertyNames(graph, propertyName, authorizations)) {
        String countAggName = "count-" + p;
        PropertyDefinition propertyDefinition = getPropertyDefinition(graph, p);
        p = replaceFieldnameDots(p);
        if (propertyDefinition != null && propertyDefinition.getTextIndexHints().contains(TextIndexHint.EXACT_MATCH)) {
            p = p + EXACT_MATCH_PROPERTY_NAME_SUFFIX;
        }

        TermsAggregationBuilder countAgg = AggregationBuilders
                .terms(countAggName)
                .field(p)
                .size(500000);
        q = q.addAggregation(countAgg);
    }

    if (ElasticsearchSearchQueryBase.QUERY_LOGGER.isTraceEnabled()) {
        ElasticsearchSearchQueryBase.QUERY_LOGGER.trace("query: %s", q);
    }
    SearchResponse response = getClient().search(q.request()).actionGet();
    Map<Object, Long> results = new HashMap<>();
    for (Aggregation agg : response.getAggregations().asList()) {
        Terms propertyCountResults = (Terms) agg;
        for (Terms.Bucket propertyCountResult : propertyCountResults.getBuckets()) {
            String mapKey = ((String) propertyCountResult.getKey()).toLowerCase();
            Long previousValue = results.get(mapKey);
            if (previousValue == null) {
                previousValue = 0L;
            }
            results.put(mapKey, previousValue + propertyCountResult.getDocCount());
        }
    }
    return results;
}
 
开发者ID:visallo,项目名称:vertexium,代码行数:44,代码来源:Elasticsearch5SearchIndex.java

示例15: load

import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; //导入依赖的package包/类
@Override public JsonArray load(long startTime, long endTime) {
        SearchRequestBuilder searchRequestBuilder = getClient().prepareSearch(ApplicationReferenceMetricTable.TABLE);
        searchRequestBuilder.setTypes(ApplicationReferenceMetricTable.TABLE_TYPE);
        searchRequestBuilder.setSearchType(SearchType.DFS_QUERY_THEN_FETCH);
        searchRequestBuilder.setQuery(QueryBuilders.rangeQuery(ApplicationReferenceMetricTable.COLUMN_TIME_BUCKET).gte(startTime).lte(endTime));
        searchRequestBuilder.setSize(0);

        TermsAggregationBuilder aggregationBuilder = AggregationBuilders.terms(ApplicationReferenceMetricTable.COLUMN_FRONT_APPLICATION_ID).field(ApplicationReferenceMetricTable.COLUMN_FRONT_APPLICATION_ID).size(100);
//        aggregationBuilder.subAggregation(AggregationBuilders.terms(ApplicationReferenceMetricTable.COLUMN_BEHIND_APPLICATION_ID).field(ApplicationReferenceMetricTable.COLUMN_BEHIND_APPLICATION_ID).size(100)
//            .subAggregation(AggregationBuilders.sum(ApplicationReferenceMetricTable.COLUMN_S1_LTE).field(ApplicationReferenceMetricTable.COLUMN_S1_LTE))
//            .subAggregation(AggregationBuilders.sum(ApplicationReferenceMetricTable.COLUMN_S3_LTE).field(ApplicationReferenceMetricTable.COLUMN_S3_LTE))
//            .subAggregation(AggregationBuilders.sum(ApplicationReferenceMetricTable.COLUMN_S5_LTE).field(ApplicationReferenceMetricTable.COLUMN_S5_LTE))
//            .subAggregation(AggregationBuilders.sum(ApplicationReferenceMetricTable.COLUMN_S5_GT).field(ApplicationReferenceMetricTable.COLUMN_S5_GT))
//            .subAggregation(AggregationBuilders.sum(ApplicationReferenceMetricTable.COLUMN_SUMMARY).field(ApplicationReferenceMetricTable.COLUMN_SUMMARY))
//            .subAggregation(AggregationBuilders.sum(ApplicationReferenceMetricTable.COLUMN_ERROR).field(ApplicationReferenceMetricTable.COLUMN_ERROR)));

        searchRequestBuilder.addAggregation(aggregationBuilder);
        SearchResponse searchResponse = searchRequestBuilder.execute().actionGet();

        JsonArray applicationReferenceMetricArray = new JsonArray();
//        Terms frontApplicationIdTerms = searchResponse.getAggregations().get(ApplicationReferenceMetricTable.COLUMN_FRONT_APPLICATION_ID);
//        for (Terms.Bucket frontApplicationIdBucket : frontApplicationIdTerms.getBuckets()) {
//            int frontApplicationId = frontApplicationIdBucket.getKeyAsNumber().intValue();
//            Terms behindApplicationIdTerms = frontApplicationIdBucket.getAggregations().get(ApplicationReferenceMetricTable.COLUMN_BEHIND_APPLICATION_ID);
//            for (Terms.Bucket behindApplicationIdBucket : behindApplicationIdTerms.getBuckets()) {
//                int behindApplicationId = behindApplicationIdBucket.getKeyAsNumber().intValue();
//
//                if (behindApplicationId != 0) {
//                    Sum s1LTE = behindApplicationIdBucket.getAggregations().get(ApplicationReferenceMetricTable.COLUMN_S1_LTE);
//                    Sum s3LTE = behindApplicationIdBucket.getAggregations().get(ApplicationReferenceMetricTable.COLUMN_S3_LTE);
//                    Sum s5LTE = behindApplicationIdBucket.getAggregations().get(ApplicationReferenceMetricTable.COLUMN_S5_LTE);
//                    Sum s5GT = behindApplicationIdBucket.getAggregations().get(ApplicationReferenceMetricTable.COLUMN_S5_GT);
//                    Sum summary = behindApplicationIdBucket.getAggregations().get(ApplicationReferenceMetricTable.COLUMN_SUMMARY);
//                    Sum error = behindApplicationIdBucket.getAggregations().get(ApplicationReferenceMetricTable.COLUMN_ERROR);
//                    logger.debug("frontApplicationId: {}, behindApplicationId: {}, s1LTE: {}, s3LTE: {}, s5LTE: {}, s5GT: {}, error: {}, summary: {}", frontApplicationId,
//                        behindApplicationId, s1LTE.getValue(), s3LTE.getValue(), s5LTE.getValue(), s5GT.getValue(), error.getValue(), summary.getValue());
//
//                    JsonObject nodeRefResSumObj = new JsonObject();
//                    nodeRefResSumObj.addProperty(ColumnNameUtils.INSTANCE.rename(ApplicationReferenceMetricTable.COLUMN_FRONT_APPLICATION_ID), frontApplicationId);
//                    nodeRefResSumObj.addProperty(ColumnNameUtils.INSTANCE.rename(ApplicationReferenceMetricTable.COLUMN_BEHIND_APPLICATION_ID), behindApplicationId);
//                    nodeRefResSumObj.addProperty(ColumnNameUtils.INSTANCE.rename(ApplicationReferenceMetricTable.COLUMN_S1_LTE), s1LTE.getValue());
//                    nodeRefResSumObj.addProperty(ColumnNameUtils.INSTANCE.rename(ApplicationReferenceMetricTable.COLUMN_S3_LTE), s3LTE.getValue());
//                    nodeRefResSumObj.addProperty(ColumnNameUtils.INSTANCE.rename(ApplicationReferenceMetricTable.COLUMN_S5_LTE), s5LTE.getValue());
//                    nodeRefResSumObj.addProperty(ColumnNameUtils.INSTANCE.rename(ApplicationReferenceMetricTable.COLUMN_S5_GT), s5GT.getValue());
//                    nodeRefResSumObj.addProperty(ColumnNameUtils.INSTANCE.rename(ApplicationReferenceMetricTable.COLUMN_ERROR), error.getValue());
//                    nodeRefResSumObj.addProperty(ColumnNameUtils.INSTANCE.rename(ApplicationReferenceMetricTable.COLUMN_SUMMARY), summary.getValue());
//                    nodeRefResSumArray.add(nodeRefResSumObj);
//                }
//            }
//        }

        return applicationReferenceMetricArray;
    }
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:54,代码来源:ApplicationReferenceMetricEsUIDAO.java


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