當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。