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.SearchProgressListener
NOOP
-
Constructor Summary
Constructors Constructor Description SearchProgressActionListener()
-
Method Summary
Modifier and Type Method Description void
onFetchFailure(int shardIndex, java.lang.Exception exc)
Executed when a shard reports a fetch failure.void
onFetchResult(int shardIndex)
Executed when a shard returns a fetch result.void
onListShards(java.util.List<SearchShard> shards, boolean fetchPhase)
Executed when shards are ready to be queried.void
onPartialReduce(java.util.List<SearchShard> shards, org.apache.lucene.search.TotalHits totalHits, InternalAggregations aggs, int version)
Executed when a partial reduce is created.void
onQueryFailure(int shardIndex, java.lang.Exception exc)
Executed when a shard reports a query failure.void
onQueryResult(int shardIndex)
Executed when a shard returns a query result.void
onReduce(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
-true
if the search needs a fetch phase,false
otherwise.
-
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.
-