Skip to content

Commit b79d2cf

Browse files
authored
Change successfulSearchShardIndices to Set<Index> (#16110) (#16243)
Signed-off-by: David Zane <[email protected]> Signed-off-by: Ankit Jain <[email protected]> (cherry picked from commit 5279d21)
1 parent 86212cc commit b79d2cf

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1010
- Add support for async deletion in S3BlobContainer ([#15621](https://github.com/opensearch-project/OpenSearch/pull/15621))
1111
- [Workload Management] QueryGroup resource cancellation framework changes ([#15651](https://github.com/opensearch-project/OpenSearch/pull/15651))
1212
- Implement WithFieldName interface in ValuesSourceAggregationBuilder & FieldSortBuilder ([#15916](https://github.com/opensearch-project/OpenSearch/pull/15916))
13-
- Add successfulSearchShardIndices in searchRequestContext ([#15967](https://github.com/opensearch-project/OpenSearch/pull/15967))
13+
- Add successfulSearchShardIndices in searchRequestContext ([#15967](https://github.com/opensearch-project/OpenSearch/pull/15967), [#16110](https://github.com/opensearch-project/OpenSearch/pull/16110))
1414
- Fallback to Remote cluster-state on Term-Version check mismatch - ([#15424](https://github.com/opensearch-project/OpenSearch/pull/15424))
1515
- [Tiered Caching] Segmented cache changes ([#16047](https://github.com/opensearch-project/OpenSearch/pull/16047))
1616
- Add support for msearch API to pass search pipeline name - ([#15923](https://github.com/opensearch-project/OpenSearch/pull/15923))

server/src/main/java/org/opensearch/action/search/AbstractSearchAsyncAction.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,9 @@ public void sendSearchResponse(InternalSearchResponse internalSearchResponse, At
755755
searchRequestContext.setTotalHits(internalSearchResponse.hits().getTotalHits());
756756
searchRequestContext.setShardStats(results.getNumShards(), successfulOps.get(), skippedOps.get(), failures.length);
757757
searchRequestContext.setSuccessfulSearchShardIndices(
758-
results.getSuccessfulResults().map(result -> result.getSearchShardTarget().getIndex()).collect(Collectors.toSet())
758+
results.getSuccessfulResults()
759+
.map(result -> result.getSearchShardTarget().getShardId().getIndex())
760+
.collect(Collectors.toSet())
759761
);
760762
onPhaseEnd(searchRequestContext);
761763
onRequestEnd(searchRequestContext);

server/src/main/java/org/opensearch/action/search/SearchRequestContext.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import org.apache.logging.log4j.Logger;
1313
import org.apache.lucene.search.TotalHits;
1414
import org.opensearch.common.annotation.InternalApi;
15+
import org.opensearch.core.index.Index;
1516
import org.opensearch.core.tasks.resourcetracker.TaskResourceInfo;
1617

1718
import java.util.ArrayList;
@@ -37,7 +38,7 @@ public class SearchRequestContext {
3738
private final Map<String, Long> phaseTookMap;
3839
private TotalHits totalHits;
3940
private final EnumMap<ShardStatsFieldNames, Integer> shardStats;
40-
private Set<String> successfulSearchShardIndices;
41+
private Set<Index> successfulSearchShardIndices;
4142

4243
private final SearchRequest searchRequest;
4344
private final LinkedBlockingQueue<TaskResourceInfo> phaseResourceUsage;
@@ -144,15 +145,15 @@ public SearchRequest getRequest() {
144145
return searchRequest;
145146
}
146147

147-
void setSuccessfulSearchShardIndices(Set<String> successfulSearchShardIndices) {
148+
void setSuccessfulSearchShardIndices(Set<Index> successfulSearchShardIndices) {
148149
this.successfulSearchShardIndices = successfulSearchShardIndices;
149150
}
150151

151152
/**
152-
* @return A {@link List} of {@link String} representing the names of the indices that were
153+
* @return A {@link Set} of {@link Index} representing the names of the indices that were
153154
* successfully queried at the shard level.
154155
*/
155-
public Set<String> getSuccessfulSearchShardIndices() {
156+
public Set<Index> getSuccessfulSearchShardIndices() {
156157
return successfulSearchShardIndices;
157158
}
158159
}

0 commit comments

Comments
 (0)