Make different routing key to isolated shard

as we know the routing cannot make sure each shard have only one routing value. is there any way to make the routing key have one shard, means new routing key, new shard.

If you want to have one tenant per shard, then routing is the wrong feature to look at. You could just have one index per tenant by using the routing key as an index name instead.

That said, I want to emphasize that you should try at keeping the total number of shards in your cluster reasonable, the optimal number being a couple per node. Why do you have this requirement to only have one tenant per shard?

Big thanks.
sometimes we just want use the routing key to do search or filter, different routing means different customer.
BTW, the optimal number shards per node should be 2 ? under what circumstances the shard number will effect the performance of ES? thanks

You might want to look into filtered ad routed aliases then, which should make things both efficient and easier to manage.

The optimal number of shards is hard to tell, it depends on many factors really, but shards should be at least a few GB in size to amortize the constant overhead of shards, and probably less than something like 50GB to keep relocations of shards not too expensive.

great, big thanks.

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