opensearch-project / OpenSearch

🔎 Open source distributed and RESTful search engine.
https://opensearch.org/docs/latest/opensearch/index/
Apache License 2.0
9.84k stars 1.83k forks source link

Change primary preference for search on searchable snapshots from `_primary` to `_primary_first` #15071

Open neetikasinghal opened 3 months ago

neetikasinghal commented 3 months ago

Currently the search preference for searchable snapshots is set to _primary, ref: https://github.com/opensearch-project/OpenSearch/blob/main/server/src/main/java/org/opensearch/cluster/routing/OperationRouting.java#L245.

Preference.PRIMARY_FIRST would mean that traffic would be routed to replicas only when primaries are not available to serve the request. So, in case of a node failure and in the interim when the replica is being promoted to primary - the search request would be served by the replica instead of getting failed in case of Preference.PRIMARY.

A similar approach is also followed for tiered remote index via https://github.com/opensearch-project/OpenSearch/pull/14934

andrross commented 3 months ago

Sounds reasonable to me.

dblock commented 3 months ago

Catch All Triage - 1, 2, 3