mirror of
https://github.com/qdrant/landing_page.git
synced 2026-09-27 23:18:29 +02:00
36 lines
1.4 KiB
Java
36 lines
1.4 KiB
Java
package com.example.snippets_amalgamation;
|
|
|
|
import static io.qdrant.client.PointIdFactory.id;
|
|
import static io.qdrant.client.ShardKeySelectorFactory.shardKeySelector;
|
|
import static io.qdrant.client.VectorsFactory.vectors;
|
|
|
|
import io.qdrant.client.QdrantClient;
|
|
import io.qdrant.client.QdrantGrpcClient;
|
|
import io.qdrant.client.grpc.Points.PointStruct;
|
|
import io.qdrant.client.grpc.Points.UpsertPoints;
|
|
import java.util.List;
|
|
|
|
public class Snippet {
|
|
public static void run() throws Exception {
|
|
// @hide-start
|
|
QdrantClient client =
|
|
new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
|
|
// @hide-end
|
|
|
|
client
|
|
.upsertAsync(
|
|
UpsertPoints.newBuilder()
|
|
.setCollectionName("{collection_name}")
|
|
.addAllPoints(
|
|
List.of(
|
|
PointStruct.newBuilder()
|
|
.setId(id(111))
|
|
.setVectors(vectors(0.1f, 0.2f, 0.3f))
|
|
.build()))
|
|
.setShardKeySelector(shardKeySelector("user_1"))
|
|
.build()
|
|
)
|
|
.get();
|
|
}
|
|
}
|