Skip to content

Commit

Permalink
Set preference to _primary when searching control-center index (#911)
Browse files Browse the repository at this point in the history
* Set preference to _primary when searching control-center index

Signed-off-by: gaobinlong <[email protected]>

* Use _primary_first instead

Signed-off-by: gaobinlong <[email protected]>

---------

Signed-off-by: gaobinlong <[email protected]>
  • Loading branch information
gaobinlong authored Sep 1, 2023
1 parent 686c2d6 commit a0f611d
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import org.opensearch.action.search.SearchResponse
import org.opensearch.action.support.ActionFilters
import org.opensearch.action.support.HandledTransportAction
import org.opensearch.client.node.NodeClient
import org.opensearch.cluster.routing.Preference
import org.opensearch.common.inject.Inject
import org.opensearch.common.xcontent.LoggingDeprecationHandler
import org.opensearch.common.xcontent.XContentHelper
Expand Down Expand Up @@ -93,6 +94,7 @@ class TransportGetLRONConfigAction @Inject constructor(
val searchRequest = SearchRequest()
.source(searchSourceBuilder)
.indices(IndexManagementPlugin.CONTROL_CENTER_INDEX)
.preference(Preference.PRIMARY_FIRST.type())

client.search(
searchRequest,
Expand Down

0 comments on commit a0f611d

Please sign in to comment.