qdrant_rust_client/examples/get_info.rs

66 lines
1.8 KiB
Rust

use qdrant_rust_client::{
models::{CollectionsResponse, Distance, InlineResponse, PointStruct},
Client,
};
#[tokio::main]
async fn main() {
let client = Client::new("localhost", 6333, "http");
let coll = "test_collection";
let res = client
.create_collection(coll, 8, Distance::Cosine)
.await
.unwrap();
let points = vec![
PointStruct {
id: 1.into(),
payload: None,
vector: vec![1.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0],
},
PointStruct {
id: 2.into(),
payload: None,
vector: vec![1.0, 1.0, 2.0, 4.0, 4.0, 5.0, 6.0, 8.0],
},
PointStruct {
id: 3.into(),
payload: None,
vector: vec![0.0, 1.0, 3.0, 3.0, 4.0, 5.0, 6.0, 8.0],
},
PointStruct {
id: 4.into(),
payload: None,
vector: vec![0.0, 1.0, 4.0, 3.0, 4.0, 5.0, 6.0, 7.0],
},
PointStruct {
id: 5.into(),
payload: None,
vector: vec![1.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0],
},
PointStruct {
id: 6.into(),
payload: None,
vector: vec![0.0, 2.0, 2.0, 4.0, 4.0, 5.0, 6.0, 7.0],
},
PointStruct {
id: 7.into(),
payload: None,
vector: vec![1.0, 3.0, 2.0, 4.0, 5.0, 5.0, 7.0, 7.0],
},
PointStruct {
id: 8.into(),
payload: None,
vector: vec![0.0, 4.0, 2.0, 3.0, 5.0, 5.0, 7.0, 7.0],
},
];
let resp = client.collection_add_points(coll, points).await.unwrap();
println!("{:#?}", resp);
let info = client.get_collection_info(coll).await.unwrap();
let res = client.delete_collection(coll).await.unwrap();
println!("{:#?}", info);
}