Package org.elasticsearch.action.search
Class SearchProgressActionListener
java.lang.Object
org.elasticsearch.action.search.SearchProgressActionListener
- All Implemented Interfaces:
ActionListener<SearchResponse>
public abstract class SearchProgressActionListener extends java.lang.Object implements ActionListener<SearchResponse>
An
ActionListener for search requests that allows to track progress of the SearchAction.
See SearchProgressListener.-
Field Summary
Fields Modifier and Type Field Description static org.elasticsearch.action.search.SearchProgressListenerNOOP -
Constructor Summary
Constructors Constructor Description SearchProgressActionListener() -
Method Summary
Modifier and Type Method Description voidonFetchFailure(int shardIndex, java.lang.Exception exc)Executed when a shard reports a fetch failure.voidonFetchResult(int shardIndex)Executed when a shard returns a fetch result.voidonListShards(java.util.List<SearchShard> shards, boolean fetchPhase)Executed when shards are ready to be queried.voidonPartialReduce(java.util.List<SearchShard> shards, org.apache.lucene.search.TotalHits totalHits, InternalAggregations aggs, int version)Executed when a partial reduce is created.voidonQueryFailure(int shardIndex, java.lang.Exception exc)Executed when a shard reports a query failure.voidonQueryResult(int shardIndex)Executed when a shard returns a query result.voidonReduce(java.util.List<SearchShard> shards, org.apache.lucene.search.TotalHits totalHits, InternalAggregations aggs)Executed once when the final reduce is created.
-
Field Details
-
NOOP
public static final org.elasticsearch.action.search.SearchProgressListener NOOP
-
-
Constructor Details
-
SearchProgressActionListener
public SearchProgressActionListener()
-
-
Method Details
-
onListShards
Executed when shards are ready to be queried.- Parameters:
shards- The list of shards to query.fetchPhase-trueif the search needs a fetch phase,falseotherwise.
-
onQueryResult
public void onQueryResult(int shardIndex)Executed when a shard returns a query result.- Parameters:
shardIndex- The index of the shard in the list provided bySearchProgressListener.onListShards(List, boolean))}.
-
onQueryFailure
public void onQueryFailure(int shardIndex, java.lang.Exception exc)Executed when a shard reports a query failure.- Parameters:
shardIndex- The index of the shard in the list provided bySearchProgressListener.onListShards(List, boolean))}.exc- The cause of the failure.
-
onPartialReduce
public void onPartialReduce(java.util.List<SearchShard> shards, org.apache.lucene.search.TotalHits totalHits, InternalAggregations aggs, int version)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.version- The version number for this reduce.
-
onReduce
public void onReduce(java.util.List<SearchShard> shards, org.apache.lucene.search.TotalHits totalHits, InternalAggregations aggs)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.
-
onFetchResult
public void onFetchResult(int shardIndex)Executed when a shard returns a fetch result.- Parameters:
shardIndex- The index of the shard in the list provided bySearchProgressListener.onListShards(List, boolean))}.
-
onFetchFailure
public void onFetchFailure(int shardIndex, java.lang.Exception exc)Executed when a shard reports a fetch failure.- Parameters:
shardIndex- The index of the shard in the list provided bySearchProgressListener.onListShards(List, boolean))}.exc- The cause of the failure.
-