Skip to content

Commit e7e2bd7

Browse files
committed
Add Rust snippet
1 parent d9957fd commit e7e2bd7

File tree

2 files changed

+38
-0
lines changed
  • qdrant-landing/content/documentation/headless/snippets/insert-points/update-mode

2 files changed

+38
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
```rust
2+
use qdrant_client::qdrant::{PointStruct, UpdateMode, UpsertPointsBuilder};
3+
4+
client
5+
.upsert_points(
6+
UpsertPointsBuilder::new(
7+
"{collection_name}",
8+
vec![
9+
PointStruct::new(1, vec![0.9, 0.1, 0.1], [("color", "red".into())]),
10+
PointStruct::new(2, vec![0.1, 0.9, 0.1], [("color", "green".into())]),
11+
PointStruct::new(3, vec![0.1, 0.1, 0.9], [("color", "blue".into())]),
12+
],
13+
)
14+
.update_mode(UpdateMode::InsertOnly),
15+
)
16+
.await?;
17+
```
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
use qdrant_client::qdrant::{PointStruct, UpdateMode, UpsertPointsBuilder};
2+
3+
pub async fn main() -> anyhow::Result<()> {
4+
let client = qdrant_client::Qdrant::from_url("http://localhost:6334").build()?; // @hide
5+
6+
client
7+
.upsert_points(
8+
UpsertPointsBuilder::new(
9+
"{collection_name}",
10+
vec![
11+
PointStruct::new(1, vec![0.9, 0.1, 0.1], [("color", "red".into())]),
12+
PointStruct::new(2, vec![0.1, 0.9, 0.1], [("color", "green".into())]),
13+
PointStruct::new(3, vec![0.1, 0.1, 0.9], [("color", "blue".into())]),
14+
],
15+
)
16+
.update_mode(UpdateMode::InsertOnly),
17+
)
18+
.await?;
19+
20+
Ok(())
21+
}

0 commit comments

Comments
 (0)