Package org.elasticsearch.action.search
Class SearchProgressListener
java.lang.Object
org.elasticsearch.action.search.SearchProgressListener
- Direct Known Subclasses:
SearchProgressActionListener
A listener that allows to track progress of the
SearchAction
.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
notifyFinalReduce(List<SearchShard> shards, org.apache.lucene.search.TotalHits totalHits, InternalAggregations aggs, int reducePhase)
protected void
onFetchFailure(int shardIndex, SearchShardTarget shardTarget, Exception exc)
Executed when a shard reports a fetch failure.protected void
onFetchResult(int shardIndex)
Executed when a shard returns a fetch result.protected void
onFinalReduce(List<SearchShard> shards, org.apache.lucene.search.TotalHits totalHits, InternalAggregations aggs, int reducePhase)
Executed once when the final reduce is created.protected void
onListShards(List<SearchShard> shards, List<SearchShard> skippedShards, SearchResponse.Clusters clusters, boolean fetchPhase)
Executed when shards are ready to be queried.protected void
onPartialReduce(List<SearchShard> shards, org.apache.lucene.search.TotalHits totalHits, InternalAggregations aggs, int reducePhase)
Executed when a partial reduce is created.protected void
onQueryFailure(int shardIndex, SearchShardTarget shardTarget, Exception exc)
Executed when a shard reports a query failure.protected void
onQueryResult(int shardIndex)
Executed when a shard returns a query result.
-
Field Details
-
NOOP
-
-
Constructor Details
-
SearchProgressListener
public SearchProgressListener()
-
-
Method Details
-
onListShards
protected void onListShards(List<SearchShard> shards, List<SearchShard> skippedShards, SearchResponse.Clusters clusters, boolean fetchPhase)Executed when shards are ready to be queried.- Parameters:
shards
- The list of shards to query.skippedShards
- The list of skipped shards.clusters
- The statistics for remote clusters included in the search.fetchPhase
-true
if the search needs a fetch phase,false
otherwise.
-
onQueryResult
protected void onQueryResult(int shardIndex)Executed when a shard returns a query result.- Parameters:
shardIndex
- The index of the shard in the list provided byonListShards(java.util.List<org.elasticsearch.action.search.SearchShard>, java.util.List<org.elasticsearch.action.search.SearchShard>, org.elasticsearch.action.search.SearchResponse.Clusters, boolean)
)}.
-
onQueryFailure
Executed when a shard reports a query failure.- Parameters:
shardIndex
- The index of the shard in the list provided byonListShards(java.util.List<org.elasticsearch.action.search.SearchShard>, java.util.List<org.elasticsearch.action.search.SearchShard>, org.elasticsearch.action.search.SearchResponse.Clusters, boolean)
)}.shardTarget
- The last shard target that thrown an exception.exc
- The cause of the failure.
-
onPartialReduce
protected void onPartialReduce(List<SearchShard> shards, org.apache.lucene.search.TotalHits totalHits, InternalAggregations aggs, int reducePhase)Executed when a partial reduce is created. The number of partial reduce can be controlled viaSearchRequest.setBatchedReduceSize(int)
.- Parameters:
shards
- The list of shards that are part of this reduce.totalHits
- The total number of hits in this reduce.aggs
- The partial result for aggregations.reducePhase
- The version number for this reduce.
-
onFinalReduce
protected void onFinalReduce(List<SearchShard> shards, org.apache.lucene.search.TotalHits totalHits, InternalAggregations aggs, int reducePhase)Executed once when the final reduce is created.- Parameters:
shards
- The list of shards that are part of this reduce.totalHits
- The total number of hits in this reduce.aggs
- The final result for aggregations.reducePhase
- The version number for this reduce.
-
onFetchResult
protected void onFetchResult(int shardIndex)Executed when a shard returns a fetch result.- Parameters:
shardIndex
- The index of the shard in the list provided byonListShards(java.util.List<org.elasticsearch.action.search.SearchShard>, java.util.List<org.elasticsearch.action.search.SearchShard>, org.elasticsearch.action.search.SearchResponse.Clusters, boolean)
)}.
-
onFetchFailure
Executed when a shard reports a fetch failure.- Parameters:
shardIndex
- The index of the shard in the list provided byonListShards(java.util.List<org.elasticsearch.action.search.SearchShard>, java.util.List<org.elasticsearch.action.search.SearchShard>, org.elasticsearch.action.search.SearchResponse.Clusters, boolean)
)}.shardTarget
- The last shard target that thrown an exception.exc
- The cause of the failure.
-
notifyFinalReduce
protected final void notifyFinalReduce(List<SearchShard> shards, org.apache.lucene.search.TotalHits totalHits, InternalAggregations aggs, int reducePhase)
-