Skip to content

Commit

Permalink
Change successfulSearchShardIndices to Set<Index> (opensearch-project…
Browse files Browse the repository at this point in the history
…#16110)

* Change successfulSearchShardIndices to Set<Index>

Signed-off-by: David Zane <[email protected]>

* Update CHANGELOG.md

Signed-off-by: Ankit Jain <[email protected]>

---------

Signed-off-by: David Zane <[email protected]>
Signed-off-by: Ankit Jain <[email protected]>
Co-authored-by: Ankit Jain <[email protected]>
  • Loading branch information
dzane17 and jainankitk authored Oct 8, 2024
1 parent 3696c29 commit 5279d21
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- [Workload Management] Add orchestrator for wlm resiliency (QueryGroupService) ([#15925](https://github.com/opensearch-project/OpenSearch/pull/15925))
- Fallback to Remote cluster-state on Term-Version check mismatch - ([#15424](https://github.com/opensearch-project/OpenSearch/pull/15424))
- Implement WithFieldName interface in ValuesSourceAggregationBuilder & FieldSortBuilder ([#15916](https://github.com/opensearch-project/OpenSearch/pull/15916))
- Add successfulSearchShardIndices in searchRequestContext ([#15967](https://github.com/opensearch-project/OpenSearch/pull/15967))
- Add successfulSearchShardIndices in searchRequestContext ([#15967](https://github.com/opensearch-project/OpenSearch/pull/15967), [#16110](https://github.com/opensearch-project/OpenSearch/pull/16110))
- [Tiered Caching] Segmented cache changes ([#16047](https://github.com/opensearch-project/OpenSearch/pull/16047))
- Add support for msearch API to pass search pipeline name - ([#15923](https://github.com/opensearch-project/OpenSearch/pull/15923))
- Add _list/indices API as paginated alternate to _cat/indices ([#14718](https://github.com/opensearch-project/OpenSearch/pull/14718))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,9 @@ public void sendSearchResponse(InternalSearchResponse internalSearchResponse, At
searchRequestContext.setTotalHits(internalSearchResponse.hits().getTotalHits());
searchRequestContext.setShardStats(results.getNumShards(), successfulOps.get(), skippedOps.get(), failures.length);
searchRequestContext.setSuccessfulSearchShardIndices(
results.getSuccessfulResults().map(result -> result.getSearchShardTarget().getIndex()).collect(Collectors.toSet())
results.getSuccessfulResults()
.map(result -> result.getSearchShardTarget().getShardId().getIndex())
.collect(Collectors.toSet())
);
onPhaseEnd(searchRequestContext);
onRequestEnd(searchRequestContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.apache.logging.log4j.Logger;
import org.apache.lucene.search.TotalHits;
import org.opensearch.common.annotation.InternalApi;
import org.opensearch.core.index.Index;
import org.opensearch.core.tasks.resourcetracker.TaskResourceInfo;

import java.util.ArrayList;
Expand All @@ -37,7 +38,7 @@ public class SearchRequestContext {
private final Map<String, Long> phaseTookMap;
private TotalHits totalHits;
private final EnumMap<ShardStatsFieldNames, Integer> shardStats;
private Set<String> successfulSearchShardIndices;
private Set<Index> successfulSearchShardIndices;

private final SearchRequest searchRequest;
private final LinkedBlockingQueue<TaskResourceInfo> phaseResourceUsage;
Expand Down Expand Up @@ -144,15 +145,15 @@ public SearchRequest getRequest() {
return searchRequest;
}

void setSuccessfulSearchShardIndices(Set<String> successfulSearchShardIndices) {
void setSuccessfulSearchShardIndices(Set<Index> successfulSearchShardIndices) {
this.successfulSearchShardIndices = successfulSearchShardIndices;
}

/**
* @return A {@link List} of {@link String} representing the names of the indices that were
* @return A {@link Set} of {@link Index} representing the names of the indices that were
* successfully queried at the shard level.
*/
public Set<String> getSuccessfulSearchShardIndices() {
public Set<Index> getSuccessfulSearchShardIndices() {
return successfulSearchShardIndices;
}
}
Expand Down

0 comments on commit 5279d21

Please sign in to comment.