Skip to content

Commit

Permalink
Add _primary preference only for segment replication enabled indices (#…
Browse files Browse the repository at this point in the history
…2040) (#2045)

* Add _primary preference only for segment replication enabled indices



* Add test for segment replication tests



* Remove isSegRepEnabled check and use _primary_first preference



* Remove unused ClusterState reference



* Self review



---------


(cherry picked from commit 9c12628)

Signed-off-by: Suraj Singh <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent c3071fd commit 9c5977f
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ private List<DataSourceMetadata> searchInDataSourcesIndex(QueryBuilder query) {
searchSourceBuilder.query(query);
searchSourceBuilder.size(DATASOURCE_QUERY_RESULT_SIZE);
searchRequest.source(searchSourceBuilder);
// https://github.com/opensearch-project/sql/issues/1801.
searchRequest.preference("_primary_first");
ActionFuture<SearchResponse> searchResponseActionFuture;
try (ThreadContext.StoredContext ignored =
client.threadPool().getThreadContext().stashContext()) {
Expand Down

0 comments on commit 9c5977f

Please sign in to comment.