Custom preference key in searching

When using a custom preference key in searches, ES ends up querying all the N shards of the index right? Surely out of N, few will be replicas, few will be primary

How does ES achieve this just using the string we pass? Does it store the preference in some cluster state for future reference so that same set of shards will be picked or is it computed in some deterministic manner (obviously)

Was going through https://github.com/elastic/elasticsearch/blob/a4ed7b1ca102267ecdda7c788713675ed3958f3f/server/src/main/java/org/elasticsearch/cluster/routing/OperationRouting.java

but lost track of how shards are decided upon

Ok found out in activeInitializingShardsIt

The custom key is given as a seed which makes the shuffling in activeInitializingShardsIt deterministic

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.