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


Java SearchResponse.getProfileResults方法代码示例

本文整理汇总了Java中org.elasticsearch.action.search.SearchResponse.getProfileResults方法的典型用法代码示例。如果您正苦于以下问题:Java SearchResponse.getProfileResults方法的具体用法?Java SearchResponse.getProfileResults怎么用?Java SearchResponse.getProfileResults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.action.search.SearchResponse的用法示例。


在下文中一共展示了SearchResponse.getProfileResults方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testNoProfile

import org.elasticsearch.action.search.SearchResponse; //导入方法依赖的package包/类
public void testNoProfile() {
    SearchResponse response = client().prepareSearch("idx").setProfile(false)
            .addAggregation(histogram("histo").field(NUMBER_FIELD).interval(1L)
                    .subAggregation(terms("tags").field(TAG_FIELD)
                            .subAggregation(avg("avg").field(NUMBER_FIELD))
                            .subAggregation(max("max").field(NUMBER_FIELD)))
                    .subAggregation(terms("strings").field(STRING_FIELD)
                            .subAggregation(avg("avg").field(NUMBER_FIELD))
                            .subAggregation(max("max").field(NUMBER_FIELD))
                            .subAggregation(terms("tags").field(TAG_FIELD)
                                    .subAggregation(avg("avg").field(NUMBER_FIELD))
                                    .subAggregation(max("max").field(NUMBER_FIELD)))))
            .get();
    assertSearchResponse(response);
    Map<String, ProfileShardResult> profileResults = response.getProfileResults();
    assertThat(profileResults, notNullValue());
    assertThat(profileResults.size(), equalTo(0));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:19,代码来源:AggregationProfilerIT.java

示例2: testSimpleProfile

import org.elasticsearch.action.search.SearchResponse; //导入方法依赖的package包/类
public void testSimpleProfile() {
    SearchResponse response = client().prepareSearch("idx").setProfile(true)
            .addAggregation(histogram("histo").field(NUMBER_FIELD).interval(1L)).get();
    assertSearchResponse(response);
    Map<String, ProfileShardResult> profileResults = response.getProfileResults();
    assertThat(profileResults, notNullValue());
    assertThat(profileResults.size(), equalTo(getNumShards("idx").numPrimaries));
    for (ProfileShardResult profileShardResult : profileResults.values()) {
        assertThat(profileShardResult, notNullValue());
        AggregationProfileShardResult aggProfileResults = profileShardResult.getAggregationProfileResults();
        assertThat(aggProfileResults, notNullValue());
        List<ProfileResult> aggProfileResultsList = aggProfileResults.getProfileResults();
        assertThat(aggProfileResultsList, notNullValue());
        assertThat(aggProfileResultsList.size(), equalTo(1));
        ProfileResult histoAggResult = aggProfileResultsList.get(0);
        assertThat(histoAggResult, notNullValue());
        assertThat(histoAggResult.getQueryName(),
                equalTo("org.elasticsearch.search.aggregations.bucket.histogram.HistogramAggregator"));
        assertThat(histoAggResult.getLuceneDescription(), equalTo("histo"));
        assertThat(histoAggResult.getProfiledChildren().size(), equalTo(0));
        assertThat(histoAggResult.getTime(), greaterThan(0L));
        Map<String, Long> breakdown = histoAggResult.getTimeBreakdown();
        assertThat(breakdown, notNullValue());
        assertThat(breakdown.get(AggregationTimingType.INITIALIZE.toString()), notNullValue());
        assertThat(breakdown.get(AggregationTimingType.INITIALIZE.toString()), greaterThan(0L));
        assertThat(breakdown.get(AggregationTimingType.COLLECT.toString()), notNullValue());
        assertThat(breakdown.get(AggregationTimingType.COLLECT.toString()), greaterThan(0L));
        assertThat(breakdown.get(AggregationTimingType.BUILD_AGGREGATION.toString()), notNullValue());
        assertThat(breakdown.get(AggregationTimingType.BUILD_AGGREGATION.toString()), greaterThan(0L));
        assertThat(breakdown.get(AggregationTimingType.REDUCE.toString()), notNullValue());
        assertThat(breakdown.get(AggregationTimingType.REDUCE.toString()), equalTo(0L));

    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:35,代码来源:AggregationProfilerIT.java

示例3: testMultiLevelProfile

import org.elasticsearch.action.search.SearchResponse; //导入方法依赖的package包/类
public void testMultiLevelProfile() {
    SearchResponse response = client().prepareSearch("idx").setProfile(true)
            .addAggregation(histogram("histo").field(NUMBER_FIELD).interval(1L)
                    .subAggregation(terms("terms").field(TAG_FIELD)
                            .subAggregation(avg("avg").field(NUMBER_FIELD)))).get();
    assertSearchResponse(response);
    Map<String, ProfileShardResult> profileResults = response.getProfileResults();
    assertThat(profileResults, notNullValue());
    assertThat(profileResults.size(), equalTo(getNumShards("idx").numPrimaries));
    for (ProfileShardResult profileShardResult : profileResults.values()) {
        assertThat(profileShardResult, notNullValue());
        AggregationProfileShardResult aggProfileResults = profileShardResult.getAggregationProfileResults();
        assertThat(aggProfileResults, notNullValue());
        List<ProfileResult> aggProfileResultsList = aggProfileResults.getProfileResults();
        assertThat(aggProfileResultsList, notNullValue());
        assertThat(aggProfileResultsList.size(), equalTo(1));
        ProfileResult histoAggResult = aggProfileResultsList.get(0);
        assertThat(histoAggResult, notNullValue());
        assertThat(histoAggResult.getQueryName(),
                equalTo("org.elasticsearch.search.aggregations.bucket.histogram.HistogramAggregator"));
        assertThat(histoAggResult.getLuceneDescription(), equalTo("histo"));
        assertThat(histoAggResult.getTime(), greaterThan(0L));
        Map<String, Long> histoBreakdown = histoAggResult.getTimeBreakdown();
        assertThat(histoBreakdown, notNullValue());
        assertThat(histoBreakdown.get(AggregationTimingType.INITIALIZE.toString()), notNullValue());
        assertThat(histoBreakdown.get(AggregationTimingType.INITIALIZE.toString()), greaterThan(0L));
        assertThat(histoBreakdown.get(AggregationTimingType.COLLECT.toString()), notNullValue());
        assertThat(histoBreakdown.get(AggregationTimingType.COLLECT.toString()), greaterThan(0L));
        assertThat(histoBreakdown.get(AggregationTimingType.BUILD_AGGREGATION.toString()), notNullValue());
        assertThat(histoBreakdown.get(AggregationTimingType.BUILD_AGGREGATION.toString()), greaterThan(0L));
        assertThat(histoBreakdown.get(AggregationTimingType.REDUCE.toString()), notNullValue());
        assertThat(histoBreakdown.get(AggregationTimingType.REDUCE.toString()), equalTo(0L));
        assertThat(histoAggResult.getProfiledChildren().size(), equalTo(1));

        ProfileResult termsAggResult = histoAggResult.getProfiledChildren().get(0);
        assertThat(termsAggResult, notNullValue());
        assertThat(termsAggResult.getQueryName(), equalTo(GlobalOrdinalsStringTermsAggregator.WithHash.class.getName()));
        assertThat(termsAggResult.getLuceneDescription(), equalTo("terms"));
        assertThat(termsAggResult.getTime(), greaterThan(0L));
        Map<String, Long> termsBreakdown = termsAggResult.getTimeBreakdown();
        assertThat(termsBreakdown, notNullValue());
        assertThat(termsBreakdown.get(AggregationTimingType.INITIALIZE.toString()), notNullValue());
        assertThat(termsBreakdown.get(AggregationTimingType.INITIALIZE.toString()), greaterThan(0L));
        assertThat(termsBreakdown.get(AggregationTimingType.COLLECT.toString()), notNullValue());
        assertThat(termsBreakdown.get(AggregationTimingType.COLLECT.toString()), greaterThan(0L));
        assertThat(termsBreakdown.get(AggregationTimingType.BUILD_AGGREGATION.toString()), notNullValue());
        assertThat(termsBreakdown.get(AggregationTimingType.BUILD_AGGREGATION.toString()), greaterThan(0L));
        assertThat(termsBreakdown.get(AggregationTimingType.REDUCE.toString()), notNullValue());
        assertThat(termsBreakdown.get(AggregationTimingType.REDUCE.toString()), equalTo(0L));
        assertThat(termsAggResult.getProfiledChildren().size(), equalTo(1));

        ProfileResult avgAggResult = termsAggResult.getProfiledChildren().get(0);
        assertThat(avgAggResult, notNullValue());
        assertThat(avgAggResult.getQueryName(), equalTo(AvgAggregator.class.getName()));
        assertThat(avgAggResult.getLuceneDescription(), equalTo("avg"));
        assertThat(avgAggResult.getTime(), greaterThan(0L));
        Map<String, Long> avgBreakdown = termsAggResult.getTimeBreakdown();
        assertThat(avgBreakdown, notNullValue());
        assertThat(avgBreakdown.get(AggregationTimingType.INITIALIZE.toString()), notNullValue());
        assertThat(avgBreakdown.get(AggregationTimingType.INITIALIZE.toString()), greaterThan(0L));
        assertThat(avgBreakdown.get(AggregationTimingType.COLLECT.toString()), notNullValue());
        assertThat(avgBreakdown.get(AggregationTimingType.COLLECT.toString()), greaterThan(0L));
        assertThat(avgBreakdown.get(AggregationTimingType.BUILD_AGGREGATION.toString()), notNullValue());
        assertThat(avgBreakdown.get(AggregationTimingType.BUILD_AGGREGATION.toString()), greaterThan(0L));
        assertThat(avgBreakdown.get(AggregationTimingType.REDUCE.toString()), notNullValue());
        assertThat(avgBreakdown.get(AggregationTimingType.REDUCE.toString()), equalTo(0L));
        assertThat(avgAggResult.getProfiledChildren().size(), equalTo(0));
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:70,代码来源:AggregationProfilerIT.java

示例4: testMultiLevelProfileBreadthFirst

import org.elasticsearch.action.search.SearchResponse; //导入方法依赖的package包/类
public void testMultiLevelProfileBreadthFirst() {
    SearchResponse response = client().prepareSearch("idx").setProfile(true)
            .addAggregation(histogram("histo").field(NUMBER_FIELD).interval(1L).subAggregation(terms("terms")
                    .collectMode(SubAggCollectionMode.BREADTH_FIRST).field(TAG_FIELD).subAggregation(avg("avg").field(NUMBER_FIELD))))
            .get();
    assertSearchResponse(response);
    Map<String, ProfileShardResult> profileResults = response.getProfileResults();
    assertThat(profileResults, notNullValue());
    assertThat(profileResults.size(), equalTo(getNumShards("idx").numPrimaries));
    for (ProfileShardResult profileShardResult : profileResults.values()) {
        assertThat(profileShardResult, notNullValue());
        AggregationProfileShardResult aggProfileResults = profileShardResult.getAggregationProfileResults();
        assertThat(aggProfileResults, notNullValue());
        List<ProfileResult> aggProfileResultsList = aggProfileResults.getProfileResults();
        assertThat(aggProfileResultsList, notNullValue());
        assertThat(aggProfileResultsList.size(), equalTo(1));
        ProfileResult histoAggResult = aggProfileResultsList.get(0);
        assertThat(histoAggResult, notNullValue());
        assertThat(histoAggResult.getQueryName(),
                equalTo("org.elasticsearch.search.aggregations.bucket.histogram.HistogramAggregator"));
        assertThat(histoAggResult.getLuceneDescription(), equalTo("histo"));
        assertThat(histoAggResult.getTime(), greaterThan(0L));
        Map<String, Long> histoBreakdown = histoAggResult.getTimeBreakdown();
        assertThat(histoBreakdown, notNullValue());
        assertThat(histoBreakdown.get(AggregationTimingType.INITIALIZE.toString()), notNullValue());
        assertThat(histoBreakdown.get(AggregationTimingType.INITIALIZE.toString()), greaterThan(0L));
        assertThat(histoBreakdown.get(AggregationTimingType.COLLECT.toString()), notNullValue());
        assertThat(histoBreakdown.get(AggregationTimingType.COLLECT.toString()), greaterThan(0L));
        assertThat(histoBreakdown.get(AggregationTimingType.BUILD_AGGREGATION.toString()), notNullValue());
        assertThat(histoBreakdown.get(AggregationTimingType.BUILD_AGGREGATION.toString()), greaterThan(0L));
        assertThat(histoBreakdown.get(AggregationTimingType.REDUCE.toString()), notNullValue());
        assertThat(histoBreakdown.get(AggregationTimingType.REDUCE.toString()), equalTo(0L));
        assertThat(histoAggResult.getProfiledChildren().size(), equalTo(1));

        ProfileResult termsAggResult = histoAggResult.getProfiledChildren().get(0);
        assertThat(termsAggResult, notNullValue());
        assertThat(termsAggResult.getQueryName(), equalTo(GlobalOrdinalsStringTermsAggregator.WithHash.class.getName()));
        assertThat(termsAggResult.getLuceneDescription(), equalTo("terms"));
        assertThat(termsAggResult.getTime(), greaterThan(0L));
        Map<String, Long> termsBreakdown = termsAggResult.getTimeBreakdown();
        assertThat(termsBreakdown, notNullValue());
        assertThat(termsBreakdown.get(AggregationTimingType.INITIALIZE.toString()), notNullValue());
        assertThat(termsBreakdown.get(AggregationTimingType.INITIALIZE.toString()), greaterThan(0L));
        assertThat(termsBreakdown.get(AggregationTimingType.COLLECT.toString()), notNullValue());
        assertThat(termsBreakdown.get(AggregationTimingType.COLLECT.toString()), greaterThan(0L));
        assertThat(termsBreakdown.get(AggregationTimingType.BUILD_AGGREGATION.toString()), notNullValue());
        assertThat(termsBreakdown.get(AggregationTimingType.BUILD_AGGREGATION.toString()), greaterThan(0L));
        assertThat(termsBreakdown.get(AggregationTimingType.REDUCE.toString()), notNullValue());
        assertThat(termsBreakdown.get(AggregationTimingType.REDUCE.toString()), equalTo(0L));
        assertThat(termsAggResult.getProfiledChildren().size(), equalTo(1));

        ProfileResult avgAggResult = termsAggResult.getProfiledChildren().get(0);
        assertThat(avgAggResult, notNullValue());
        assertThat(avgAggResult.getQueryName(), equalTo(AvgAggregator.class.getName()));
        assertThat(avgAggResult.getLuceneDescription(), equalTo("avg"));
        assertThat(avgAggResult.getTime(), greaterThan(0L));
        Map<String, Long> avgBreakdown = termsAggResult.getTimeBreakdown();
        assertThat(avgBreakdown, notNullValue());
        assertThat(avgBreakdown.get(AggregationTimingType.INITIALIZE.toString()), notNullValue());
        assertThat(avgBreakdown.get(AggregationTimingType.INITIALIZE.toString()), greaterThan(0L));
        assertThat(avgBreakdown.get(AggregationTimingType.COLLECT.toString()), notNullValue());
        assertThat(avgBreakdown.get(AggregationTimingType.COLLECT.toString()), greaterThan(0L));
        assertThat(avgBreakdown.get(AggregationTimingType.BUILD_AGGREGATION.toString()), notNullValue());
        assertThat(avgBreakdown.get(AggregationTimingType.BUILD_AGGREGATION.toString()), greaterThan(0L));
        assertThat(avgBreakdown.get(AggregationTimingType.REDUCE.toString()), notNullValue());
        assertThat(avgBreakdown.get(AggregationTimingType.REDUCE.toString()), equalTo(0L));
        assertThat(avgAggResult.getProfiledChildren().size(), equalTo(0));
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:70,代码来源:AggregationProfilerIT.java

示例5: testDiversifiedAggProfile

import org.elasticsearch.action.search.SearchResponse; //导入方法依赖的package包/类
public void testDiversifiedAggProfile() {
    SearchResponse response = client().prepareSearch("idx").setProfile(true)
            .addAggregation(diversifiedSampler("diversify").shardSize(10).field(STRING_FIELD).maxDocsPerValue(2)
                    .subAggregation(max("max").field(NUMBER_FIELD)))
            .get();
    assertSearchResponse(response);
    Map<String, ProfileShardResult> profileResults = response.getProfileResults();
    assertThat(profileResults, notNullValue());
    assertThat(profileResults.size(), equalTo(getNumShards("idx").numPrimaries));
    for (ProfileShardResult profileShardResult : profileResults.values()) {
        assertThat(profileShardResult, notNullValue());
        AggregationProfileShardResult aggProfileResults = profileShardResult.getAggregationProfileResults();
        assertThat(aggProfileResults, notNullValue());
        List<ProfileResult> aggProfileResultsList = aggProfileResults.getProfileResults();
        assertThat(aggProfileResultsList, notNullValue());
        assertThat(aggProfileResultsList.size(), equalTo(1));
        ProfileResult diversifyAggResult = aggProfileResultsList.get(0);
        assertThat(diversifyAggResult, notNullValue());
        assertThat(diversifyAggResult.getQueryName(),
                equalTo(DiversifiedOrdinalsSamplerAggregator.class.getName()));
        assertThat(diversifyAggResult.getLuceneDescription(), equalTo("diversify"));
        assertThat(diversifyAggResult.getTime(), greaterThan(0L));
        Map<String, Long> histoBreakdown = diversifyAggResult.getTimeBreakdown();
        assertThat(histoBreakdown, notNullValue());
        assertThat(histoBreakdown.get(AggregationTimingType.INITIALIZE.toString()), notNullValue());
        assertThat(histoBreakdown.get(AggregationTimingType.INITIALIZE.toString()), greaterThan(0L));
        assertThat(histoBreakdown.get(AggregationTimingType.COLLECT.toString()), notNullValue());
        assertThat(histoBreakdown.get(AggregationTimingType.COLLECT.toString()), greaterThan(0L));
        assertThat(histoBreakdown.get(AggregationTimingType.BUILD_AGGREGATION.toString()), notNullValue());
        assertThat(histoBreakdown.get(AggregationTimingType.BUILD_AGGREGATION.toString()), greaterThan(0L));
        assertThat(histoBreakdown.get(AggregationTimingType.REDUCE.toString()), notNullValue());
        assertThat(histoBreakdown.get(AggregationTimingType.REDUCE.toString()), equalTo(0L));
        assertThat(diversifyAggResult.getProfiledChildren().size(), equalTo(1));

        ProfileResult maxAggResult = diversifyAggResult.getProfiledChildren().get(0);
        assertThat(maxAggResult, notNullValue());
        assertThat(maxAggResult.getQueryName(), equalTo(MaxAggregator.class.getName()));
        assertThat(maxAggResult.getLuceneDescription(), equalTo("max"));
        assertThat(maxAggResult.getTime(), greaterThan(0L));
        Map<String, Long> termsBreakdown = maxAggResult.getTimeBreakdown();
        assertThat(termsBreakdown, notNullValue());
        assertThat(termsBreakdown.get(AggregationTimingType.INITIALIZE.toString()), notNullValue());
        assertThat(termsBreakdown.get(AggregationTimingType.INITIALIZE.toString()), greaterThan(0L));
        assertThat(termsBreakdown.get(AggregationTimingType.COLLECT.toString()), notNullValue());
        assertThat(termsBreakdown.get(AggregationTimingType.COLLECT.toString()), greaterThan(0L));
        assertThat(termsBreakdown.get(AggregationTimingType.BUILD_AGGREGATION.toString()), notNullValue());
        assertThat(termsBreakdown.get(AggregationTimingType.BUILD_AGGREGATION.toString()), greaterThan(0L));
        assertThat(termsBreakdown.get(AggregationTimingType.REDUCE.toString()), notNullValue());
        assertThat(termsBreakdown.get(AggregationTimingType.REDUCE.toString()), equalTo(0L));
        assertThat(maxAggResult.getProfiledChildren().size(), equalTo(0));
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:53,代码来源:AggregationProfilerIT.java


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