Skip to content

Commit 5590b3f

Browse files
authored
Add some Javadocs to TransportSearchAction and adjacent classes. (#110733)
1 parent 8417d3f commit 5590b3f

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

server/src/main/java/org/elasticsearch/action/ResolvedIndices.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
import java.util.Map;
2828
import java.util.Set;
2929

30+
/**
31+
* Container for information about results of the resolution of index expression.
32+
* Contains local indices, map of remote indices and metadata.
33+
*/
3034
public class ResolvedIndices {
3135
@Nullable
3236
private final SearchContextId searchContextId;

server/src/main/java/org/elasticsearch/action/search/TransportSearchAction.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,7 @@ static SearchResponseMerger createSearchResponseMerger(
711711
}
712712

713713
/**
714+
* Collect remote search shards that we need to search for potential matches.
714715
* Used for ccs_minimize_roundtrips=false
715716
*/
716717
static void collectSearchShards(
@@ -988,6 +989,10 @@ static BiFunction<String, String, DiscoveryNode> getRemoteClusterNodeLookup(Map<
988989
};
989990
}
990991

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+
*/
991996
static List<SearchShardIterator> getRemoteShardsIterator(
992997
Map<String, SearchShardsResponse> searchShardsResponses,
993998
Map<String, OriginalIndices> remoteIndicesByCluster,
@@ -1085,6 +1090,9 @@ private static boolean checkAllRemotePITShardsWereReturnedBySearchShards(
10851090
.allMatch(searchContextIdForNode -> searchContextIdForNode.getClusterAlias() == null);
10861091
}
10871092

1093+
/**
1094+
* If any of the indices we are searching are frozen, issue deprecation warning.
1095+
*/
10881096
void frozenIndexCheck(ResolvedIndices resolvedIndices) {
10891097
List<String> frozenIndices = new ArrayList<>();
10901098
Map<Index, IndexMetadata> indexMetadataMap = resolvedIndices.getConcreteLocalIndicesMetadata();
@@ -1104,6 +1112,10 @@ void frozenIndexCheck(ResolvedIndices resolvedIndices) {
11041112
}
11051113
}
11061114

1115+
/**
1116+
* Execute search locally and for all given remote shards.
1117+
* Used when minimize_roundtrips=false or for local search.
1118+
*/
11071119
private void executeSearch(
11081120
SearchTask task,
11091121
SearchTimeProvider timeProvider,
@@ -1500,6 +1512,11 @@ private static void failIfOverShardCountLimit(ClusterService clusterService, int
15001512
}
15011513
}
15021514

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+
*/
15031520
abstract static class CCSActionListener<Response, FinalResponse> implements ActionListener<Response> {
15041521
protected final String clusterAlias;
15051522
protected final boolean skipUnavailable;
@@ -1533,6 +1550,9 @@ public final void onResponse(Response response) {
15331550
maybeFinish();
15341551
}
15351552

1553+
/**
1554+
* Specific listener type will implement this method to process its specific partial response.
1555+
*/
15361556
abstract void innerOnResponse(Response response);
15371557

15381558
@Override
@@ -1670,6 +1690,10 @@ static List<SearchShardIterator> getLocalLocalShardsIteratorFromPointInTime(
16701690
return iterators;
16711691
}
16721692

1693+
/**
1694+
* Create a list of {@link SearchShardIterator}s for the local indices we are searching.
1695+
* This resolves aliases and index expressions.
1696+
*/
16731697
List<SearchShardIterator> getLocalShardsIterator(
16741698
ClusterState clusterState,
16751699
SearchRequest searchRequest,

server/src/main/java/org/elasticsearch/rest/action/search/SearchResponseMetrics.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515
import java.util.Map;
1616

17+
/**
18+
* Container class for aggregated metrics about search responses.
19+
*/
1720
public class SearchResponseMetrics {
1821

1922
public enum ResponseCountTotalStatus {

0 commit comments

Comments
 (0)