Module org.elasticsearch.server
Package org.elasticsearch.action.search
Class CCSSingleCoordinatorSearchProgressListener
java.lang.Object
org.elasticsearch.action.search.SearchProgressListener
org.elasticsearch.action.search.CCSSingleCoordinatorSearchProgressListener
Use this progress listener for cross-cluster searches where a single
coordinator is used for all clusters (minimize_roundtrips=false).
It updates state in the SearchResponse.Clusters object as the search
progresses so that the metadata required for the _clusters/details
section in the SearchResponse is accurate.
-
Field Summary
Fields inherited from class org.elasticsearch.action.search.SearchProgressListener
NOOP
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
onFetchFailure
(int shardIndex, SearchShardTarget shardTarget, Exception exc) Executed when a shard reports a fetch failure.void
onFetchResult
(int shardIndex) Executed when a shard returns a fetch result.void
onFinalReduce
(List<SearchShard> shards, org.apache.lucene.search.TotalHits totalHits, InternalAggregations aggs, int reducePhase) Executed once when the final reduce is created.void
onListShards
(List<SearchShard> shards, List<SearchShard> skipped, SearchResponse.Clusters clusters, boolean fetchPhase, TransportSearchAction.SearchTimeProvider timeProvider) Executed when shards are ready to be queried (after can-match)void
onPartialReduce
(List<SearchShard> shards, org.apache.lucene.search.TotalHits totalHits, InternalAggregations aggs, int reducePhase) Executed when a partial reduce is created.void
onQueryFailure
(int shardIndex, SearchShardTarget shardTarget, Exception e) Executed when a shard reports a query failure.void
onQueryResult
(int shardIndex, QuerySearchResult queryResult) Executed when a shard returns a query result.Methods inherited from class org.elasticsearch.action.search.SearchProgressListener
notifyFinalReduce, onClusterResponseMinimizeRoundtrips
-
Constructor Details
-
CCSSingleCoordinatorSearchProgressListener
public CCSSingleCoordinatorSearchProgressListener()
-
-
Method Details
-
onListShards
public void onListShards(List<SearchShard> shards, List<SearchShard> skipped, SearchResponse.Clusters clusters, boolean fetchPhase, TransportSearchAction.SearchTimeProvider timeProvider) Executed when shards are ready to be queried (after can-match)- Overrides:
onListShards
in classSearchProgressListener
- Parameters:
shards
- The list of shards to query.skipped
- 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.timeProvider
- absolute and relative time provider for this search
-
onQueryResult
Executed when a shard returns a query result.- Overrides:
onQueryResult
in classSearchProgressListener
- Parameters:
shardIndex
- The index of the shard in the list provided bySearchProgressListener.onListShards(java.util.List<org.elasticsearch.action.search.SearchShard>, java.util.List<org.elasticsearch.action.search.SearchShard>, org.elasticsearch.action.search.SearchResponse.Clusters, boolean, org.elasticsearch.action.search.TransportSearchAction.SearchTimeProvider)
.queryResult
- QuerySearchResult holding the result for a SearchShardTarget
-
onQueryFailure
Executed when a shard reports a query failure.- Overrides:
onQueryFailure
in classSearchProgressListener
- Parameters:
shardIndex
- The index of the shard in the list provided bySearchProgressListener.onListShards(java.util.List<org.elasticsearch.action.search.SearchShard>, java.util.List<org.elasticsearch.action.search.SearchShard>, org.elasticsearch.action.search.SearchResponse.Clusters, boolean, org.elasticsearch.action.search.TransportSearchAction.SearchTimeProvider)
)}.shardTarget
- The last shard target that thrown an exception.e
- The cause of the failure.
-
onPartialReduce
public 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)
. Note that onPartialReduce and onFinalReduce are called with cumulative data so far. For example if the first call to onPartialReduce has 5 shards, the second call will have those same 5 shards plus the new batch. onFinalReduce will see all those shards one final time.- Overrides:
onPartialReduce
in classSearchProgressListener
- 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
public void onFinalReduce(List<SearchShard> shards, org.apache.lucene.search.TotalHits totalHits, InternalAggregations aggs, int reducePhase) Executed once when the final reduce is created. Note that his will see all the shards, even if they have been passed to the onPartialReduce method already.- Overrides:
onFinalReduce
in classSearchProgressListener
- 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
public void onFetchResult(int shardIndex) Executed when a shard returns a fetch result.- Overrides:
onFetchResult
in classSearchProgressListener
- Parameters:
shardIndex
- The index of the shard in the list provided bySearchProgressListener.onListShards(java.util.List<org.elasticsearch.action.search.SearchShard>, java.util.List<org.elasticsearch.action.search.SearchShard>, org.elasticsearch.action.search.SearchResponse.Clusters, boolean, org.elasticsearch.action.search.TransportSearchAction.SearchTimeProvider)
)}.
-
onFetchFailure
Executed when a shard reports a fetch failure.- Overrides:
onFetchFailure
in classSearchProgressListener
- Parameters:
shardIndex
- The index of the shard in the list provided bySearchProgressListener.onListShards(java.util.List<org.elasticsearch.action.search.SearchShard>, java.util.List<org.elasticsearch.action.search.SearchShard>, org.elasticsearch.action.search.SearchResponse.Clusters, boolean, org.elasticsearch.action.search.TransportSearchAction.SearchTimeProvider)
)}.shardTarget
- The last shard target that thrown an exception.exc
- The cause of the failure.
-