- Notifications
You must be signed in to change notification settings - Fork 25.6k
Description
The search shards API is a public API, that the search and async search API use internally when executing cross-cluster search requests (and roundtrips are not minimized). For each remote cluster involved in the search request, search shards will be invoked to collect information about the remote shards that have to be queried. The API accepts a set of indices and returns a set of shards that the coordinating node includes in the search request. Ideally, such API would accept a query and perform the coordinator can_match phase, so that it does not return shards that could be easily skipped. The coordinator can_match phase skips shards based on index metadata (min and max) that is present in the cluster state, which the CCS coordinating cluster is not aware of for remote indices.
This would help unify the search behaviour between local and remote searches. Today searchable snapshots allow to skip shards completely when the query has a timerange filter against the @timestamp field that can not possibly match, and this is good to avoid throwing shards failures for irrelevant shards in the situation where frozen indices are not available (can happen as they don't have replicas).