mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-10 21:38:30 +02:00
[v1.16] Collection metadata docs (#1986)
* wip: initial docs * docs: Go snippets Signed-off-by: Anush008 <anushshetty90@gmail.com> * docs: Java snippets Signed-off-by: Anush008 <anushshetty90@gmail.com> * docs: Removed TODO! Signed-off-by: Anush008 <anushshetty90@gmail.com> * docs: C# snippets Signed-off-by: Anush008 <anushshetty90@gmail.com> * move collection metadata section into collection info * fix code fence mismatch in markdown * Remove empty line --------- Signed-off-by: Anush008 <anushshetty90@gmail.com> Co-authored-by: Anush008 <anushshetty90@gmail.com> Co-authored-by: trean <trean.mi@gmail.com> Co-authored-by: Tim Visée <tim@visee.me>
This commit is contained in:
co-authored by
Anush008
trean
Tim Visée
parent
be24d900ef
commit
5ed4822559
+1
@@ -0,0 +1 @@
|
||||
Update collection metadata. This example demonstrates how to overwrite a specific field in the collection's metadata while leaving other fields unchanged. Collection metadata can be any JSON object that provides additional information about the collection.
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
```bash
|
||||
curl -X PATCH http://localhost:6333/collections/{collection_name} \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"metadata": {
|
||||
"my-metadata-field": {
|
||||
"key-a": "value-a",
|
||||
"key-b": 42
|
||||
}
|
||||
}
|
||||
}'
|
||||
```
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
```csharp
|
||||
using Qdrant.Client;
|
||||
using Qdrant.Client.Grpc;
|
||||
|
||||
var client = new QdrantClient("localhost", 6334);
|
||||
|
||||
await client.UpdateCollectionAsync(
|
||||
collectionName: "{collection_name}",
|
||||
optimizersConfig: new OptimizersConfigDiff { IndexingThreshold = 10000 },
|
||||
metadata: new()
|
||||
{
|
||||
["my-metadata-field"] = new Dictionary<string, Value>
|
||||
{
|
||||
["key-a"] = "value-a",
|
||||
["key-b"] = 42
|
||||
},
|
||||
}
|
||||
);
|
||||
```
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
```go
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/qdrant/go-client/qdrant"
|
||||
)
|
||||
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
client.UpdateCollection(context.Background(), &qdrant.UpdateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
OptimizersConfig: &qdrant.OptimizersConfigDiff{
|
||||
IndexingThreshold: qdrant.PtrOf(uint64(10000)),
|
||||
},
|
||||
Metadata: qdrant.NewValueMap(map[string]any{
|
||||
"my-metadata-field": map[string]any{
|
||||
"key-a": "value-a",
|
||||
"key-b": 42,
|
||||
},
|
||||
}),
|
||||
})
|
||||
```
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
```http
|
||||
PATCH /collections/{collection_name}
|
||||
{
|
||||
"metadata": {
|
||||
"my-metadata-field": {
|
||||
"key-a": "value-a",
|
||||
"key-b": 42
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
```java
|
||||
import java.util.Map;
|
||||
|
||||
import static io.qdrant.client.ValueFactory.value;
|
||||
|
||||
import io.qdrant.client.grpc.Collections.OptimizersConfigDiff;
|
||||
import io.qdrant.client.grpc.Collections.UpdateCollection;
|
||||
|
||||
client
|
||||
.updateCollectionAsync(
|
||||
UpdateCollection.newBuilder()
|
||||
.setCollectionName("{collection_name}")
|
||||
.setOptimizersConfig(
|
||||
OptimizersConfigDiff.newBuilder().setIndexingThreshold(10000).build())
|
||||
.putAllMetadata(
|
||||
Map.of(
|
||||
"my-metadata-field",
|
||||
value(
|
||||
Map.of(
|
||||
"key-a", value("value-a"),
|
||||
"key-b", value(42)))))
|
||||
.build())
|
||||
.get();
|
||||
```
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
```python
|
||||
client.update_collection(
|
||||
collection_name="{collection_name}",
|
||||
metadata={
|
||||
"my-metadata-field": {
|
||||
"key-a": "value-a",
|
||||
"key-b": 42
|
||||
}
|
||||
},
|
||||
)
|
||||
```
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
```rust
|
||||
use qdrant_client::qdrant::{UpdateCollectionBuilder};
|
||||
use qdrant_client::Qdrant;
|
||||
use serde_json::{json, Value};
|
||||
use std::collections::HashMap;
|
||||
|
||||
let client = Qdrant::from_url("http://localhost:6334").build()?;
|
||||
|
||||
let mut metadata: HashMap<String, Value> = HashMap::new();
|
||||
metadata.insert("my-metadata-field".to_string(), json!({
|
||||
"key-a": "value-a",
|
||||
"key-b": 42
|
||||
}));
|
||||
|
||||
client
|
||||
.update_collection(
|
||||
UpdateCollectionBuilder::new("{collection_name}").metadata(metadata),
|
||||
)
|
||||
.await?;
|
||||
```
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
```typescript
|
||||
client.updateCollection("{collection_name}", {
|
||||
metadata: {
|
||||
"my-metadata-field": {
|
||||
"key-a": "value-a",
|
||||
"key-b": 42
|
||||
}
|
||||
},
|
||||
});
|
||||
```
|
||||
Reference in New Issue
Block a user