mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-09 21:08:31 +02:00
docs: Go, Java, C# snippets
Signed-off-by: Anush008 <anushshetty90@gmail.com>
This commit is contained in:
+9
-12
@@ -2,21 +2,17 @@
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static io.qdrant.client.ShardKeyFactory.shardKey;
|
||||
|
||||
import io.qdrant.client.QdrantClient;
|
||||
import io.qdrant.client.QdrantGrpcClient;
|
||||
import io.qdrant.client.grpc.Points.PointStruct;
|
||||
|
||||
import io.qdrant.client.ShardKeyFactory.shardKey;
|
||||
import io.qdrant.client.grpc.Points.ShardKeySelector;
|
||||
|
||||
QdrantClient client =
|
||||
new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
|
||||
|
||||
ShardKeySelector.Builder shardkeySelectorBuilder = ShardKeySelector.newBuilder();
|
||||
shardkeySelectorBuilder.addShardKeys(shardKey("user_1"));
|
||||
shardkeySelectorBuilder.setFallback(shardKey("default"));
|
||||
ShardKeySelector shardKeySelector = shardkeySelectorBuilder.build();
|
||||
|
||||
client
|
||||
.upsertAsync(
|
||||
UpsertPoints.newBuilder()
|
||||
@@ -27,11 +23,12 @@ client
|
||||
.setId(id(1))
|
||||
.setVectors(vectors(0.9f, 0.1f, 0.1f))
|
||||
.putAllPayload(Map.of("group_id", value("user_1")))
|
||||
.build()
|
||||
)
|
||||
)
|
||||
.setShardKeySelector(shardKeySelector)
|
||||
.build()
|
||||
)
|
||||
.build()))
|
||||
.setShardKeySelector(
|
||||
ShardKeySelector.newBuilder()
|
||||
.addShardKeys(shardKey("user_1"))
|
||||
.setFallback(shardKey("default"))
|
||||
.build())
|
||||
.build())
|
||||
.get();
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user