java.lang.Object
org.elasticsearch.search.profile.AbstractProfiler<QueryProfileBreakdown,org.apache.lucene.search.Query>
org.elasticsearch.search.profile.query.QueryProfiler

public final class QueryProfiler extends AbstractProfiler<QueryProfileBreakdown,org.apache.lucene.search.Query>
This class acts as a thread-local storage for profiling a query. It also builds a representation of the query tree which is built constructed "online" as the weights are wrapped by ContextIndexSearcher. This allows us to know the relationship between nodes in tree without explicitly walking the tree or pre-wrapping everything A Profiler is associated with every Search, not per Search-Request. E.g. a request may execute two searches (query + global agg). A Profiler just represents one of those
  • Constructor Details

    • QueryProfiler

      public QueryProfiler()
  • Method Details

    • setVectorOpsCount

      public void setVectorOpsCount(long vectorOpsCount)
    • getVectorOpsCount

      public long getVectorOpsCount()
    • setCollectorResult

      public void setCollectorResult(CollectorResult collectorResult)
      Set the collector result that is associated with this profiler.
    • startRewriteTime

      public Timer startRewriteTime()
      Begin timing the rewrite phase of a request. All rewrites are accumulated together into a single metric
    • stopAndAddRewriteTime

      public long stopAndAddRewriteTime(Timer rewriteTimer)
      Stop recording the current rewrite and add it's time to the total tally, returning the cumulative time so far.
      Returns:
      cumulative rewrite time
    • getRewriteTime

      public long getRewriteTime()
      Returns:
      total time taken to rewrite all queries in this profile
    • getCollectorResult

      public CollectorResult getCollectorResult()
      Return the current root Collector for this search