From 2d8261d567f993c6d1f42b0135e40a4611d9d42f Mon Sep 17 00:00:00 2001 From: timvisee Date: Tue, 28 Nov 2023 16:04:58 +0100 Subject: [PATCH] Add snippets with snapshot priority example --- .../documentation/concepts/snapshots.md | 46 +++++++++++++++++-- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/qdrant-landing/content/documentation/concepts/snapshots.md b/qdrant-landing/content/documentation/concepts/snapshots.md index fcd3ceb83..0a6b23cf7 100644 --- a/qdrant-landing/content/documentation/concepts/snapshots.md +++ b/qdrant-landing/content/documentation/concepts/snapshots.md @@ -207,8 +207,7 @@ import { QdrantClient } from "@qdrant/js-client-rest"; const client = new QdrantClient({ host: "localhost", port: 6333 }); client.recoverSnapshot("{collection_name}", { - location: - "http://qdrant-node-1:6333/collections/collection_name/snapshots/snapshot-2022-10-10.shapshot", + location: "http://qdrant-node-1:6333/collections/collection_name/snapshots/snapshot-2022-10-10.shapshot", }); ``` @@ -218,7 +217,6 @@ The recovery snapshot can also be uploaded as a file to the Qdrant server: curl -X POST 'http://qdrant-node-1:6333/collections/collection_name/snapshots/upload' \ -H 'Content-Type:multipart/form-data' \ -F 'snapshot=@/path/to/snapshot-2022-10-10.shapshot' - ``` @@ -249,6 +247,48 @@ managing shards and transferring shards between clusters manually without any additional synchronization. Using it incorrectly will leave your cluster in a broken state. +For recovery from an URL you specify a request parameter: + +```http +PUT /collections/{collection_name}/snapshots/recover + +{ + "location": "http://qdrant-node-1:6333/collections/{collection_name}/snapshots/snapshot-2022-10-10.shapshot", + "priority": "snapshot" +} +``` + +```python +from qdrant_client import QdrantClient, models + +client = QdrantClient("qdrant-node-2", port=6333) + +client.recover_snapshot( + "{collection_name}", + "http://qdrant-node-1:6333/collections/collection_name/snapshots/snapshot-2022-10-10.shapshot", + priority=models.SnapshotPriority.SNAPSHOT, +) +``` + +```typescript +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.recoverSnapshot("{collection_name}", { + location: "http://qdrant-node-1:6333/collections/collection_name/snapshots/snapshot-2022-10-10.shapshot", + priority: "snapshot" +}); +``` + +For uploading a multipart file you specify it as URL parameter: + +```bash +curl -X POST 'http://qdrant-node-1:6333/collections/collection_name/snapshots/upload?priority=snapshot' \ + -H 'Content-Type:multipart/form-data' \ + -F 'snapshot=@/path/to/snapshot-2022-10-10.shapshot' +``` + ## Snapshots for the whole storage *Available as of v0.8.5*