Class QueryProfiler

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

    • setCollector

      public void setCollector(InternalProfileCollector collector)
      Set the collector that is associated with this profiler.
    • startRewriteTime

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

      public long stopAndAddRewriteTime()
      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
    • getCollector

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