qdrant-client icon indicating copy to clipboard operation
qdrant-client copied to clipboard

how to get shard keys for collection when using custom sharding

Open raulcarlomagno opened this issue 1 year ago • 1 comments

hii! i would like to know how to get the list of all shard keys for a custom sharded collection ?

thanks

raulcarlomagno avatar Jan 23 '24 16:01 raulcarlomagno

Hi

Hm, I am afraid that there is no convenient way to get it yet..

However there is a way, e.g.:

>>> cl.http.cluster_api.collection_cluster_info('{collection_name}')
InlineResponse2007(time=4.5083e-05, status='ok', result=CollectionClusterInfo(peer_id=2931637626479673, shard_count=1, local_shards=[LocalShardInfo(shard_id=1, shard_key='user_1', points_count=1, state=<ReplicaState.ACTIVE: 'Active'>)], remote_shards=[], shard_transfers=[]))

And then you need to iterate over local shards and remote shards and extract shard_key

Sorry for the inconvenience :(

joein avatar Jan 23 '24 16:01 joein