Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change successfulSearchShardIndices to Set<Index> #16110

Merged
merged 3 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- [Workload Management] QueryGroup resource cancellation framework changes ([#15651](https://github.com/opensearch-project/OpenSearch/pull/15651))
- 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))
- 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))
- Add success and failure metrics for async shard fetch ([#15976](https://github.com/opensearch-project/OpenSearch/pull/15976))
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
dzane17 marked this conversation as resolved.
Show resolved Hide resolved
* successfully queried at the shard level.
*/
public Set<String> getSuccessfulSearchShardIndices() {
public Set<Index> getSuccessfulSearchShardIndices() {
return successfulSearchShardIndices;
}
}
Expand Down
Loading