@@ -711,6 +711,7 @@ static SearchResponseMerger createSearchResponseMerger(
711
711
}
712
712
713
713
/**
714
+ * Collect remote search shards that we need to search for potential matches.
714
715
* Used for ccs_minimize_roundtrips=false
715
716
*/
716
717
static void collectSearchShards (
@@ -988,6 +989,10 @@ static BiFunction<String, String, DiscoveryNode> getRemoteClusterNodeLookup(Map<
988
989
};
989
990
}
990
991
992
+ /**
993
+ * Produce a list of {@link SearchShardIterator}s from the set of responses from remote clusters.
994
+ * Used for ccs_minimize_roundtrips=false.
995
+ */
991
996
static List <SearchShardIterator > getRemoteShardsIterator (
992
997
Map <String , SearchShardsResponse > searchShardsResponses ,
993
998
Map <String , OriginalIndices > remoteIndicesByCluster ,
@@ -1085,6 +1090,9 @@ private static boolean checkAllRemotePITShardsWereReturnedBySearchShards(
1085
1090
.allMatch (searchContextIdForNode -> searchContextIdForNode .getClusterAlias () == null );
1086
1091
}
1087
1092
1093
+ /**
1094
+ * If any of the indices we are searching are frozen, issue deprecation warning.
1095
+ */
1088
1096
void frozenIndexCheck (ResolvedIndices resolvedIndices ) {
1089
1097
List <String > frozenIndices = new ArrayList <>();
1090
1098
Map <Index , IndexMetadata > indexMetadataMap = resolvedIndices .getConcreteLocalIndicesMetadata ();
@@ -1104,6 +1112,10 @@ void frozenIndexCheck(ResolvedIndices resolvedIndices) {
1104
1112
}
1105
1113
}
1106
1114
1115
+ /**
1116
+ * Execute search locally and for all given remote shards.
1117
+ * Used when minimize_roundtrips=false or for local search.
1118
+ */
1107
1119
private void executeSearch (
1108
1120
SearchTask task ,
1109
1121
SearchTimeProvider timeProvider ,
@@ -1500,6 +1512,11 @@ private static void failIfOverShardCountLimit(ClusterService clusterService, int
1500
1512
}
1501
1513
}
1502
1514
1515
+ /**
1516
+ * {@link ActionListener} suitable for collecting cross-cluster responses.
1517
+ * @param <Response> Response type we're getting as intermediate per-cluster results.
1518
+ * @param <FinalResponse> Response type that the final listener expects.
1519
+ */
1503
1520
abstract static class CCSActionListener <Response , FinalResponse > implements ActionListener <Response > {
1504
1521
protected final String clusterAlias ;
1505
1522
protected final boolean skipUnavailable ;
@@ -1533,6 +1550,9 @@ public final void onResponse(Response response) {
1533
1550
maybeFinish ();
1534
1551
}
1535
1552
1553
+ /**
1554
+ * Specific listener type will implement this method to process its specific partial response.
1555
+ */
1536
1556
abstract void innerOnResponse (Response response );
1537
1557
1538
1558
@ Override
@@ -1670,6 +1690,10 @@ static List<SearchShardIterator> getLocalLocalShardsIteratorFromPointInTime(
1670
1690
return iterators ;
1671
1691
}
1672
1692
1693
+ /**
1694
+ * Create a list of {@link SearchShardIterator}s for the local indices we are searching.
1695
+ * This resolves aliases and index expressions.
1696
+ */
1673
1697
List <SearchShardIterator > getLocalShardsIterator (
1674
1698
ClusterState clusterState ,
1675
1699
SearchRequest searchRequest ,
0 commit comments