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
-
Field Summary
Fields inherited from class org.elasticsearch.search.profile.AbstractProfiler
profileTree
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addVectorOpsCount
(long vectorOpsCount) Adds a number of vector operations to the current countReturn the current root Collector for this searchlong
long
Retrieves the number of vector operations performed by the queriesvoid
setCollectorResult
(CollectorResult collectorResult) Set the collector result that is associated with this profiler.Begin timing the rewrite phase of a request.long
stopAndAddRewriteTime
(Timer rewriteTimer) Stop recording the current rewrite and add it's time to the total tally, returning the cumulative time so far.Methods inherited from class org.elasticsearch.search.profile.AbstractProfiler
getQueryBreakdown, getTree, pollLastElement
-
Constructor Details
-
QueryProfiler
public QueryProfiler()
-
-
Method Details
-
addVectorOpsCount
public void addVectorOpsCount(long vectorOpsCount) Adds a number of vector operations to the current count- Parameters:
vectorOpsCount
- number of vector ops to add to the profiler
-
getVectorOpsCount
public long getVectorOpsCount()Retrieves the number of vector operations performed by the queries- Returns:
- number of vector operations performed by the queries
-
setCollectorResult
Set the collector result that is associated with this profiler. -
startRewriteTime
Begin timing the rewrite phase of a request. All rewrites are accumulated together into a single metric -
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
-
getCollectorResult
Return the current root Collector for this search
-