Search in sources :

Example 1 with QueryProfiler

use of org.elasticsearch.search.profile.query.QueryProfiler in project elasticsearch by elastic.

the class Profilers method addQueryProfiler.

/** Switch to a new profile. */
public QueryProfiler addQueryProfiler() {
    QueryProfiler profiler = new QueryProfiler();
    searcher.setProfiler(profiler);
    queryProfilers.add(profiler);
    return profiler;
}
Also used : QueryProfiler(org.elasticsearch.search.profile.query.QueryProfiler)

Example 2 with QueryProfiler

use of org.elasticsearch.search.profile.query.QueryProfiler in project elasticsearch by elastic.

the class SearchProfileShardResults method buildShardResults.

/**
     * Helper method to convert Profiler into InternalProfileShardResults, which
     * can be serialized to other nodes, emitted as JSON, etc.
     *
     * @param profilers
     *            The {@link Profilers} to convert into results
     * @return A {@link ProfileShardResult} representing the results for this
     *         shard
     */
public static ProfileShardResult buildShardResults(Profilers profilers) {
    List<QueryProfiler> queryProfilers = profilers.getQueryProfilers();
    AggregationProfiler aggProfiler = profilers.getAggregationProfiler();
    List<QueryProfileShardResult> queryResults = new ArrayList<>(queryProfilers.size());
    for (QueryProfiler queryProfiler : queryProfilers) {
        QueryProfileShardResult result = new QueryProfileShardResult(queryProfiler.getTree(), queryProfiler.getRewriteTime(), queryProfiler.getCollector());
        queryResults.add(result);
    }
    AggregationProfileShardResult aggResults = new AggregationProfileShardResult(aggProfiler.getTree());
    return new ProfileShardResult(queryResults, aggResults);
}
Also used : AggregationProfileShardResult(org.elasticsearch.search.profile.aggregation.AggregationProfileShardResult) QueryProfileShardResult(org.elasticsearch.search.profile.query.QueryProfileShardResult) AggregationProfiler(org.elasticsearch.search.profile.aggregation.AggregationProfiler) ArrayList(java.util.ArrayList) QueryProfiler(org.elasticsearch.search.profile.query.QueryProfiler) QueryProfileShardResult(org.elasticsearch.search.profile.query.QueryProfileShardResult) AggregationProfileShardResult(org.elasticsearch.search.profile.aggregation.AggregationProfileShardResult)

Aggregations

QueryProfiler (org.elasticsearch.search.profile.query.QueryProfiler)2 ArrayList (java.util.ArrayList)1 AggregationProfileShardResult (org.elasticsearch.search.profile.aggregation.AggregationProfileShardResult)1 AggregationProfiler (org.elasticsearch.search.profile.aggregation.AggregationProfiler)1 QueryProfileShardResult (org.elasticsearch.search.profile.query.QueryProfileShardResult)1