mirror of
https://github.com/qdrant/landing_page.git
synced 2026-09-25 22:18:30 +02:00
Shortcode for rendering code snippets from separate markdown files (#1548)
* shortcode for rendering code snippets from separate markdown files * formatted code * fix and readme * semi-automatically extracts snippets from markdown * extract snippets from points.md * extract snippets from vectors.md * extract snippets from payload.md * extract snippets from search.md + fixes * extract snippets from explore.md * extract snippets from hybrid-queries.md + mode query by id into search * extract snippets from filtering.md * extract snippets from storage.md + update outdated info * extract snippets from indexing.md * extract snippets from snapshots.md * extract snippets from guides/optimize.md * extract snippets from guides/multiple-partitions.md + fix aside note * extract snippets from guides/quantization.md * use auto-generated descriptions * order json snippets first --------- Co-authored-by: generall <andrey@vasnetsov.com>
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
---
|
||||
build:
|
||||
list: never
|
||||
publishResources: false
|
||||
render: never
|
||||
cascade:
|
||||
- build:
|
||||
list: never
|
||||
publishResources: false
|
||||
render: never
|
||||
---
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
snippetsOrder:
|
||||
- json
|
||||
- http
|
||||
- bash
|
||||
- python
|
||||
- typescript
|
||||
- rust
|
||||
- java
|
||||
- csharp
|
||||
- go
|
||||
---
|
||||
+1
@@ -0,0 +1 @@
|
||||
With this code snippet, you can perform batch operations on points like upserting, updating vectors, deleting vectors, setting, overwriting, deleting, and clearing payload data associated with points. The operations include inserting, updating, and deleting points along with their vectors and payload. Each operation is executed in order specified in the request payload.
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
```http
|
||||
POST /collections/{collection_name}/points/batch
|
||||
{
|
||||
"operations": [
|
||||
{
|
||||
"upsert": {
|
||||
"points": [
|
||||
{
|
||||
"id": 1,
|
||||
"vector": [1.0, 2.0, 3.0, 4.0],
|
||||
"payload": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"update_vectors": {
|
||||
"points": [
|
||||
{
|
||||
"id": 1,
|
||||
"vector": [1.0, 2.0, 3.0, 4.0]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"delete_vectors": {
|
||||
"points": [1],
|
||||
"vector": [""]
|
||||
}
|
||||
},
|
||||
{
|
||||
"overwrite_payload": {
|
||||
"payload": {
|
||||
"test_payload": "1"
|
||||
},
|
||||
"points": [1]
|
||||
}
|
||||
},
|
||||
{
|
||||
"set_payload": {
|
||||
"payload": {
|
||||
"test_payload_2": "2",
|
||||
"test_payload_3": "3"
|
||||
},
|
||||
"points": [1]
|
||||
}
|
||||
},
|
||||
{
|
||||
"delete_payload": {
|
||||
"keys": ["test_payload_2"],
|
||||
"points": [1]
|
||||
}
|
||||
},
|
||||
{
|
||||
"clear_payload": {
|
||||
"points": [1]
|
||||
}
|
||||
},
|
||||
{"delete": {"points": [1]}}
|
||||
]
|
||||
}
|
||||
```
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
```java
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static io.qdrant.client.PointIdFactory.id;
|
||||
import static io.qdrant.client.ValueFactory.value;
|
||||
import static io.qdrant.client.VectorsFactory.vectors;
|
||||
|
||||
import io.qdrant.client.grpc.Points.PointStruct;
|
||||
import io.qdrant.client.grpc.Points.PointVectors;
|
||||
import io.qdrant.client.grpc.Points.PointsIdsList;
|
||||
import io.qdrant.client.grpc.Points.PointsSelector;
|
||||
import io.qdrant.client.grpc.Points.PointsUpdateOperation;
|
||||
import io.qdrant.client.grpc.Points.PointsUpdateOperation.ClearPayload;
|
||||
import io.qdrant.client.grpc.Points.PointsUpdateOperation.DeletePayload;
|
||||
import io.qdrant.client.grpc.Points.PointsUpdateOperation.DeletePoints;
|
||||
import io.qdrant.client.grpc.Points.PointsUpdateOperation.DeleteVectors;
|
||||
import io.qdrant.client.grpc.Points.PointsUpdateOperation.PointStructList;
|
||||
import io.qdrant.client.grpc.Points.PointsUpdateOperation.SetPayload;
|
||||
import io.qdrant.client.grpc.Points.PointsUpdateOperation.UpdateVectors;
|
||||
import io.qdrant.client.grpc.Points.VectorsSelector;
|
||||
|
||||
client
|
||||
.batchUpdateAsync(
|
||||
"{collection_name}",
|
||||
List.of(
|
||||
PointsUpdateOperation.newBuilder()
|
||||
.setUpsert(
|
||||
PointStructList.newBuilder()
|
||||
.addPoints(
|
||||
PointStruct.newBuilder()
|
||||
.setId(id(1))
|
||||
.setVectors(vectors(1.0f, 2.0f, 3.0f, 4.0f))
|
||||
.build())
|
||||
.build())
|
||||
.build(),
|
||||
PointsUpdateOperation.newBuilder()
|
||||
.setUpdateVectors(
|
||||
UpdateVectors.newBuilder()
|
||||
.addPoints(
|
||||
PointVectors.newBuilder()
|
||||
.setId(id(1))
|
||||
.setVectors(vectors(1.0f, 2.0f, 3.0f, 4.0f))
|
||||
.build())
|
||||
.build())
|
||||
.build(),
|
||||
PointsUpdateOperation.newBuilder()
|
||||
.setDeleteVectors(
|
||||
DeleteVectors.newBuilder()
|
||||
.setPointsSelector(
|
||||
PointsSelector.newBuilder()
|
||||
.setPoints(PointsIdsList.newBuilder().addIds(id(1)).build())
|
||||
.build())
|
||||
.setVectors(VectorsSelector.newBuilder().addNames("").build())
|
||||
.build())
|
||||
.build(),
|
||||
PointsUpdateOperation.newBuilder()
|
||||
.setOverwritePayload(
|
||||
SetPayload.newBuilder()
|
||||
.setPointsSelector(
|
||||
PointsSelector.newBuilder()
|
||||
.setPoints(PointsIdsList.newBuilder().addIds(id(1)).build())
|
||||
.build())
|
||||
.putAllPayload(Map.of("test_payload", value(1)))
|
||||
.build())
|
||||
.build(),
|
||||
PointsUpdateOperation.newBuilder()
|
||||
.setSetPayload(
|
||||
SetPayload.newBuilder()
|
||||
.setPointsSelector(
|
||||
PointsSelector.newBuilder()
|
||||
.setPoints(PointsIdsList.newBuilder().addIds(id(1)).build())
|
||||
.build())
|
||||
.putAllPayload(
|
||||
Map.of("test_payload_2", value(2), "test_payload_3", value(3)))
|
||||
.build())
|
||||
.build(),
|
||||
PointsUpdateOperation.newBuilder()
|
||||
.setDeletePayload(
|
||||
DeletePayload.newBuilder()
|
||||
.setPointsSelector(
|
||||
PointsSelector.newBuilder()
|
||||
.setPoints(PointsIdsList.newBuilder().addIds(id(1)).build())
|
||||
.build())
|
||||
.addKeys("test_payload_2")
|
||||
.build())
|
||||
.build(),
|
||||
PointsUpdateOperation.newBuilder()
|
||||
.setClearPayload(
|
||||
ClearPayload.newBuilder()
|
||||
.setPoints(
|
||||
PointsSelector.newBuilder()
|
||||
.setPoints(PointsIdsList.newBuilder().addIds(id(1)).build())
|
||||
.build())
|
||||
.build())
|
||||
.build(),
|
||||
PointsUpdateOperation.newBuilder()
|
||||
.setDeletePoints(
|
||||
DeletePoints.newBuilder()
|
||||
.setPoints(
|
||||
PointsSelector.newBuilder()
|
||||
.setPoints(PointsIdsList.newBuilder().addIds(id(1)).build())
|
||||
.build())
|
||||
.build())
|
||||
.build()))
|
||||
.get();
|
||||
```
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
```python
|
||||
client.batch_update_points(
|
||||
collection_name="{collection_name}",
|
||||
update_operations=[
|
||||
models.UpsertOperation(
|
||||
upsert=models.PointsList(
|
||||
points=[
|
||||
models.PointStruct(
|
||||
id=1,
|
||||
vector=[1.0, 2.0, 3.0, 4.0],
|
||||
payload={},
|
||||
),
|
||||
]
|
||||
)
|
||||
),
|
||||
models.UpdateVectorsOperation(
|
||||
update_vectors=models.UpdateVectors(
|
||||
points=[
|
||||
models.PointVectors(
|
||||
id=1,
|
||||
vector=[1.0, 2.0, 3.0, 4.0],
|
||||
)
|
||||
]
|
||||
)
|
||||
),
|
||||
models.DeleteVectorsOperation(
|
||||
delete_vectors=models.DeleteVectors(points=[1], vector=[""])
|
||||
),
|
||||
models.OverwritePayloadOperation(
|
||||
overwrite_payload=models.SetPayload(
|
||||
payload={"test_payload": 1},
|
||||
points=[1],
|
||||
)
|
||||
),
|
||||
models.SetPayloadOperation(
|
||||
set_payload=models.SetPayload(
|
||||
payload={
|
||||
"test_payload_2": 2,
|
||||
"test_payload_3": 3,
|
||||
},
|
||||
points=[1],
|
||||
)
|
||||
),
|
||||
models.DeletePayloadOperation(
|
||||
delete_payload=models.DeletePayload(keys=["test_payload_2"], points=[1])
|
||||
),
|
||||
models.ClearPayloadOperation(clear_payload=models.PointIdsList(points=[1])),
|
||||
models.DeleteOperation(delete=models.PointIdsList(points=[1])),
|
||||
],
|
||||
)
|
||||
```
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
```rust
|
||||
use std::collections::HashMap;
|
||||
|
||||
use qdrant_client::qdrant::{
|
||||
points_update_operation::{
|
||||
ClearPayload, DeletePayload, DeletePoints, DeleteVectors, Operation, OverwritePayload,
|
||||
PointStructList, SetPayload, UpdateVectors,
|
||||
},
|
||||
PointStruct, PointVectors, PointsUpdateOperation, UpdateBatchPointsBuilder, VectorsSelector,
|
||||
};
|
||||
use qdrant_client::Payload;
|
||||
|
||||
client
|
||||
.update_points_batch(
|
||||
UpdateBatchPointsBuilder::new(
|
||||
"{collection_name}",
|
||||
vec![
|
||||
PointsUpdateOperation {
|
||||
operation: Some(Operation::Upsert(PointStructList {
|
||||
points: vec![PointStruct::new(
|
||||
1,
|
||||
vec![1.0, 2.0, 3.0, 4.0],
|
||||
Payload::default(),
|
||||
)],
|
||||
..Default::default()
|
||||
})),
|
||||
},
|
||||
PointsUpdateOperation {
|
||||
operation: Some(Operation::UpdateVectors(UpdateVectors {
|
||||
points: vec![PointVectors {
|
||||
id: Some(1.into()),
|
||||
vectors: Some(vec![1.0, 2.0, 3.0, 4.0].into()),
|
||||
}],
|
||||
..Default::default()
|
||||
})),
|
||||
},
|
||||
PointsUpdateOperation {
|
||||
operation: Some(Operation::DeleteVectors(DeleteVectors {
|
||||
points_selector: Some(vec![1.into()].into()),
|
||||
vectors: Some(VectorsSelector {
|
||||
names: vec!["".into()],
|
||||
}),
|
||||
..Default::default()
|
||||
})),
|
||||
},
|
||||
PointsUpdateOperation {
|
||||
operation: Some(Operation::OverwritePayload(OverwritePayload {
|
||||
points_selector: Some(vec![1.into()].into()),
|
||||
payload: HashMap::from([("test_payload".to_string(), 1.into())]),
|
||||
..Default::default()
|
||||
})),
|
||||
},
|
||||
PointsUpdateOperation {
|
||||
operation: Some(Operation::SetPayload(SetPayload {
|
||||
points_selector: Some(vec![1.into()].into()),
|
||||
payload: HashMap::from([
|
||||
("test_payload_2".to_string(), 2.into()),
|
||||
("test_payload_3".to_string(), 3.into()),
|
||||
]),
|
||||
..Default::default()
|
||||
})),
|
||||
},
|
||||
PointsUpdateOperation {
|
||||
operation: Some(Operation::DeletePayload(DeletePayload {
|
||||
points_selector: Some(vec![1.into()].into()),
|
||||
keys: vec!["test_payload_2".to_string()],
|
||||
..Default::default()
|
||||
})),
|
||||
},
|
||||
PointsUpdateOperation {
|
||||
operation: Some(Operation::ClearPayload(ClearPayload {
|
||||
points: Some(vec![1.into()].into()),
|
||||
..Default::default()
|
||||
})),
|
||||
},
|
||||
PointsUpdateOperation {
|
||||
operation: Some(Operation::DeletePoints(DeletePoints {
|
||||
points: Some(vec![1.into()].into()),
|
||||
..Default::default()
|
||||
})),
|
||||
},
|
||||
],
|
||||
)
|
||||
.wait(true),
|
||||
)
|
||||
.await?;
|
||||
```
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
```typescript
|
||||
client.batchUpdate("{collection_name}", {
|
||||
operations: [
|
||||
{
|
||||
upsert: {
|
||||
points: [
|
||||
{
|
||||
id: 1,
|
||||
vector: [1.0, 2.0, 3.0, 4.0],
|
||||
payload: {},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
update_vectors: {
|
||||
points: [
|
||||
{
|
||||
id: 1,
|
||||
vector: [1.0, 2.0, 3.0, 4.0],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
delete_vectors: {
|
||||
points: [1],
|
||||
vector: [""],
|
||||
},
|
||||
},
|
||||
{
|
||||
overwrite_payload: {
|
||||
payload: {
|
||||
test_payload: 1,
|
||||
},
|
||||
points: [1],
|
||||
},
|
||||
},
|
||||
{
|
||||
set_payload: {
|
||||
payload: {
|
||||
test_payload_2: 2,
|
||||
test_payload_3: 3,
|
||||
},
|
||||
points: [1],
|
||||
},
|
||||
},
|
||||
{
|
||||
delete_payload: {
|
||||
keys: ["test_payload_2"],
|
||||
points: [1],
|
||||
},
|
||||
},
|
||||
{
|
||||
clear_payload: {
|
||||
points: [1],
|
||||
},
|
||||
},
|
||||
{
|
||||
delete: {
|
||||
points: [1],
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
```
|
||||
+1
@@ -0,0 +1 @@
|
||||
This code snippet demonstrates a feature to check if a collection exists by making a GET request to a specified endpoint that includes the collection name. This functionality is available starting from version 1.8.0.
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
```bash
|
||||
curl -X GET http://localhost:6333/collections/{collection_name}/exists
|
||||
```
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
```csharp
|
||||
await client.CollectionExistsAsync("{collection_name}");
|
||||
```
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
```go
|
||||
import "context"
|
||||
|
||||
client.CollectionExists(context.Background(), "my_collection")
|
||||
```
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
```http
|
||||
GET http://localhost:6333/collections/{collection_name}/exists
|
||||
```
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
```java
|
||||
client.collectionExistsAsync("{collection_name}").get();
|
||||
```
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
```python
|
||||
client.collection_exists(collection_name="{collection_name}")
|
||||
```
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
```rust
|
||||
client.collection_exists("{collection_name}").await?;
|
||||
```
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
```typescript
|
||||
client.collectionExists("{collection_name}");
|
||||
```
|
||||
+1
@@ -0,0 +1 @@
|
||||
This code snippet demonstrates a functionality to clear payload keys from specific points by providing a list of point identifiers.
|
||||
@@ -0,0 +1,7 @@
|
||||
```csharp
|
||||
using Qdrant.Client;
|
||||
|
||||
var client = new QdrantClient("localhost", 6334);
|
||||
|
||||
await client.ClearPayloadAsync(collectionName: "{collection_name}", ids: new ulong[] { 0, 3, 100 });
|
||||
```
|
||||
@@ -0,0 +1,19 @@
|
||||
```go
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/qdrant/go-client/qdrant"
|
||||
)
|
||||
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
client.ClearPayload(context.Background(), &qdrant.ClearPayloadPoints{
|
||||
CollectionName: "{collection_name}",
|
||||
Points: qdrant.NewPointsSelector(
|
||||
qdrant.NewIDNum(0),
|
||||
qdrant.NewIDNum(3)),
|
||||
})
|
||||
```
|
||||
@@ -0,0 +1,6 @@
|
||||
```http
|
||||
POST /collections/{collection_name}/points/payload/clear
|
||||
{
|
||||
"points": [0, 3, 100]
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,9 @@
|
||||
```java
|
||||
import java.util.List;
|
||||
|
||||
import static io.qdrant.client.PointIdFactory.id;
|
||||
|
||||
client
|
||||
.clearPayloadAsync("{collection_name}", List.of(id(0), id(3), id(100)), true, null, null)
|
||||
.get();
|
||||
```
|
||||
@@ -0,0 +1,6 @@
|
||||
```python
|
||||
client.clear_payload(
|
||||
collection_name="{collection_name}",
|
||||
points_selector=[0, 3, 100],
|
||||
)
|
||||
```
|
||||
@@ -0,0 +1,13 @@
|
||||
```rust
|
||||
use qdrant_client::qdrant::{ClearPayloadPointsBuilder, PointsIdsList};
|
||||
|
||||
client
|
||||
.clear_payload(
|
||||
ClearPayloadPointsBuilder::new("{collection_name}")
|
||||
.points(PointsIdsList {
|
||||
ids: vec![0.into(), 3.into(), 10.into()],
|
||||
})
|
||||
.wait(true),
|
||||
)
|
||||
.await?;
|
||||
```
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
```typescript
|
||||
client.clearPayload("{collection_name}", {
|
||||
points: [0, 3, 100],
|
||||
});
|
||||
```
|
||||
+1
@@ -0,0 +1 @@
|
||||
This code snippet creates an alias named "production_collection" for the collection called "example_collection".
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
```bash
|
||||
curl -X POST http://localhost:6333/collections/aliases \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"actions": [
|
||||
{
|
||||
"create_alias": {
|
||||
"collection_name": "example_collection",
|
||||
"alias_name": "production_collection"
|
||||
}
|
||||
}
|
||||
]
|
||||
}'
|
||||
```
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
```csharp
|
||||
await client.CreateAliasAsync(aliasName: "production_collection", collectionName: "example_collection");
|
||||
```
|
||||
@@ -0,0 +1,5 @@
|
||||
```go
|
||||
import "context"
|
||||
|
||||
client.CreateAlias(context.Background(), "production_collection", "example_collection")
|
||||
```
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
```http
|
||||
POST /collections/aliases
|
||||
{
|
||||
"actions": [
|
||||
{
|
||||
"create_alias": {
|
||||
"collection_name": "example_collection",
|
||||
"alias_name": "production_collection"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
```java
|
||||
client.createAliasAsync("production_collection", "example_collection").get();
|
||||
```
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
```python
|
||||
client.update_collection_aliases(
|
||||
change_aliases_operations=[
|
||||
models.CreateAliasOperation(
|
||||
create_alias=models.CreateAlias(
|
||||
collection_name="example_collection", alias_name="production_collection"
|
||||
)
|
||||
)
|
||||
]
|
||||
)
|
||||
```
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
```rust
|
||||
use qdrant_client::qdrant::CreateAliasBuilder;
|
||||
|
||||
client
|
||||
.create_alias(CreateAliasBuilder::new(
|
||||
"example_collection",
|
||||
"production_collection",
|
||||
))
|
||||
.await?;
|
||||
```
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
```typescript
|
||||
client.updateCollectionAliases({
|
||||
actions: [
|
||||
{
|
||||
create_alias: {
|
||||
collection_name: "example_collection",
|
||||
alias_name: "production_collection",
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
```
|
||||
+1
@@ -0,0 +1 @@
|
||||
This code snippet is aiming to perform an action of removing an alias named "production_collection" within a collection alias in a system.
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
```bash
|
||||
curl -X POST http://localhost:6333/collections/aliases \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"actions": [
|
||||
{
|
||||
"delete_alias": {
|
||||
"alias_name": "production_collection"
|
||||
}
|
||||
}
|
||||
]
|
||||
}'
|
||||
```
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
```csharp
|
||||
await client.DeleteAliasAsync("production_collection");
|
||||
```
|
||||
@@ -0,0 +1,5 @@
|
||||
```go
|
||||
import "context"
|
||||
|
||||
client.DeleteAlias(context.Background(), "production_collection")
|
||||
```
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
```http
|
||||
POST /collections/aliases
|
||||
{
|
||||
"actions": [
|
||||
{
|
||||
"delete_alias": {
|
||||
"alias_name": "production_collection"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
```java
|
||||
client.deleteAliasAsync("production_collection").get();
|
||||
```
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
```python
|
||||
client.update_collection_aliases(
|
||||
change_aliases_operations=[
|
||||
models.DeleteAliasOperation(
|
||||
delete_alias=models.DeleteAlias(alias_name="production_collection")
|
||||
),
|
||||
]
|
||||
)
|
||||
```
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
```rust
|
||||
client.delete_alias("production_collection").await?;
|
||||
```
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
```typescript
|
||||
client.updateCollectionAliases({
|
||||
actions: [
|
||||
{
|
||||
delete_alias: {
|
||||
alias_name: "production_collection",
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
```
|
||||
+1
@@ -0,0 +1 @@
|
||||
This code snippet is used to retrieve all aliases from a collection.
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
```bash
|
||||
curl -X GET http://localhost:6333/aliases
|
||||
```
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
```csharp
|
||||
using Qdrant.Client;
|
||||
|
||||
var client = new QdrantClient("localhost", 6334);
|
||||
|
||||
await client.ListAliasesAsync();
|
||||
```
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
```go
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/qdrant/go-client/qdrant"
|
||||
)
|
||||
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
client.ListAliases(context.Background())
|
||||
```
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
```http
|
||||
GET /aliases
|
||||
```
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
```java
|
||||
import io.qdrant.client.QdrantClient;
|
||||
import io.qdrant.client.QdrantGrpcClient;
|
||||
|
||||
QdrantClient client =
|
||||
new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
|
||||
|
||||
client.listAliasesAsync().get();
|
||||
```
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
```python
|
||||
from qdrant_client import QdrantClient
|
||||
|
||||
client = QdrantClient(url="http://localhost:6333")
|
||||
|
||||
client.get_aliases()
|
||||
```
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
```rust
|
||||
use qdrant_client::Qdrant;
|
||||
|
||||
let client = Qdrant::from_url("http://localhost:6334").build()?;
|
||||
|
||||
client.list_aliases().await?;
|
||||
```
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
```typescript
|
||||
import { QdrantClient } from "@qdrant/js-client-rest";
|
||||
|
||||
const client = new QdrantClient({ host: "localhost", port: 6333 });
|
||||
|
||||
client.getAliases();
|
||||
```
|
||||
+1
@@ -0,0 +1 @@
|
||||
This code retrieves a list of aliases associated with a specific collection.
|
||||
@@ -0,0 +1,3 @@
|
||||
```bash
|
||||
curl -X GET http://localhost:6333/collections/{collection_name}/aliases
|
||||
```
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
```csharp
|
||||
using Qdrant.Client;
|
||||
|
||||
var client = new QdrantClient("localhost", 6334);
|
||||
|
||||
await client.ListCollectionAliasesAsync("{collection_name}");
|
||||
```
|
||||
@@ -0,0 +1,14 @@
|
||||
```go
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/qdrant/go-client/qdrant"
|
||||
)
|
||||
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
client.ListCollectionAliases(context.Background(), "{collection_name}")
|
||||
```
|
||||
@@ -0,0 +1,3 @@
|
||||
```http
|
||||
GET /collections/{collection_name}/aliases
|
||||
```
|
||||
@@ -0,0 +1,9 @@
|
||||
```java
|
||||
import io.qdrant.client.QdrantClient;
|
||||
import io.qdrant.client.QdrantGrpcClient;
|
||||
|
||||
QdrantClient client =
|
||||
new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
|
||||
|
||||
client.listCollectionAliasesAsync("{collection_name}").get();
|
||||
```
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
```python
|
||||
from qdrant_client import QdrantClient
|
||||
|
||||
client = QdrantClient(url="http://localhost:6333")
|
||||
|
||||
client.get_collection_aliases(collection_name="{collection_name}")
|
||||
```
|
||||
@@ -0,0 +1,7 @@
|
||||
```rust
|
||||
use qdrant_client::Qdrant;
|
||||
|
||||
let client = Qdrant::from_url("http://localhost:6334").build()?;
|
||||
|
||||
client.list_collection_aliases("{collection_name}").await?;
|
||||
```
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
```typescript
|
||||
import { QdrantClient } from "@qdrant/js-client-rest";
|
||||
|
||||
const client = new QdrantClient({ host: "localhost", port: 6333 });
|
||||
|
||||
client.getCollectionAliases("{collection_name}");
|
||||
```
|
||||
+1
@@ -0,0 +1 @@
|
||||
Perform atomic alias actions to switch collections. In this scenario, there is a POST request made to manage aliases. The code snippet demonstrates a sequence of actions where an alias named "production_collection" is deleted, and then a new alias with the same name is created for the "example_collection". This allows for switching between collections efficiently.
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
```bash
|
||||
curl -X POST http://localhost:6333/collections/aliases \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"actions": [
|
||||
{
|
||||
"delete_alias": {
|
||||
"alias_name": "production_collection"
|
||||
}
|
||||
},
|
||||
{
|
||||
"create_alias": {
|
||||
"collection_name": "example_collection",
|
||||
"alias_name": "production_collection"
|
||||
}
|
||||
}
|
||||
]
|
||||
}'
|
||||
```
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
```csharp
|
||||
await client.DeleteAliasAsync("production_collection");
|
||||
await client.CreateAliasAsync(aliasName: "production_collection", collectionName: "example_collection");
|
||||
```
|
||||
@@ -0,0 +1,6 @@
|
||||
```go
|
||||
import "context"
|
||||
|
||||
client.DeleteAlias(context.Background(), "production_collection")
|
||||
client.CreateAlias(context.Background(), "production_collection", "example_collection")
|
||||
```
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
```http
|
||||
POST /collections/aliases
|
||||
{
|
||||
"actions": [
|
||||
{
|
||||
"delete_alias": {
|
||||
"alias_name": "production_collection"
|
||||
}
|
||||
},
|
||||
{
|
||||
"create_alias": {
|
||||
"collection_name": "example_collection",
|
||||
"alias_name": "production_collection"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
```java
|
||||
client.deleteAliasAsync("production_collection").get();
|
||||
client.createAliasAsync("production_collection", "example_collection").get();
|
||||
```
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
```python
|
||||
client.update_collection_aliases(
|
||||
change_aliases_operations=[
|
||||
models.DeleteAliasOperation(
|
||||
delete_alias=models.DeleteAlias(alias_name="production_collection")
|
||||
),
|
||||
models.CreateAliasOperation(
|
||||
create_alias=models.CreateAlias(
|
||||
collection_name="example_collection", alias_name="production_collection"
|
||||
)
|
||||
),
|
||||
]
|
||||
)
|
||||
```
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
```rust
|
||||
use qdrant_client::qdrant::CreateAliasBuilder;
|
||||
|
||||
client.delete_alias("production_collection").await?;
|
||||
client
|
||||
.create_alias(CreateAliasBuilder::new(
|
||||
"example_collection",
|
||||
"production_collection",
|
||||
))
|
||||
.await?;
|
||||
```
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
```typescript
|
||||
client.updateCollectionAliases({
|
||||
actions: [
|
||||
{
|
||||
delete_alias: {
|
||||
alias_name: "production_collection",
|
||||
},
|
||||
},
|
||||
{
|
||||
create_alias: {
|
||||
collection_name: "example_collection",
|
||||
alias_name: "production_collection",
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
```
|
||||
+1
@@ -0,0 +1 @@
|
||||
This code snippet showcases a feature where you can retrieve information about an existing collection in order to understand how the points are distributed and indexed within it.
|
||||
@@ -0,0 +1,3 @@
|
||||
```bash
|
||||
curl -X GET http://localhost:6333/collections/{collection_name}
|
||||
```
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
```csharp
|
||||
await client.GetCollectionInfoAsync("{collection_name}");
|
||||
```
|
||||
@@ -0,0 +1,5 @@
|
||||
```go
|
||||
import "context"
|
||||
|
||||
client.GetCollectionInfo(context.Background(), "{collection_name}")
|
||||
```
|
||||
@@ -0,0 +1,3 @@
|
||||
```http
|
||||
GET /collections/{collection_name}
|
||||
```
|
||||
@@ -0,0 +1,3 @@
|
||||
```java
|
||||
client.getCollectionInfoAsync("{collection_name}").get();
|
||||
```
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
```python
|
||||
client.get_collection(collection_name="{collection_name}")
|
||||
```
|
||||
@@ -0,0 +1,3 @@
|
||||
```rust
|
||||
client.collection_info("{collection_name}").await?;
|
||||
```
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
```typescript
|
||||
client.getCollection("{collection_name}");
|
||||
```
|
||||
+1
@@ -0,0 +1 @@
|
||||
This code snippet demonstrates a POST request to count points based on specific filter conditions within a collection. The filter criteria include checking for points with a key "color" that matches the value "red" precisely. By setting the "exact" parameter to true, the count will consider only exact matches. This functionality is helpful for scenarios such as evaluating result sizes for faceted search, determining pagination numbers, and debugging query performance.
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
```csharp
|
||||
using Qdrant.Client;
|
||||
using static Qdrant.Client.Grpc.Conditions;
|
||||
|
||||
var client = new QdrantClient("localhost", 6334);
|
||||
|
||||
await client.CountAsync(
|
||||
collectionName: "{collection_name}",
|
||||
filter: MatchKeyword("color", "red"),
|
||||
exact: true
|
||||
);
|
||||
```
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
```go
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/qdrant/go-client/qdrant"
|
||||
)
|
||||
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
client.Count(context.Background(), &qdrant.CountPoints{
|
||||
CollectionName: "midlib",
|
||||
Filter: &qdrant.Filter{
|
||||
Must: []*qdrant.Condition{
|
||||
qdrant.NewMatch("color", "red"),
|
||||
},
|
||||
},
|
||||
})
|
||||
```
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
```http
|
||||
POST /collections/{collection_name}/points/count
|
||||
{
|
||||
"filter": {
|
||||
"must": [
|
||||
{
|
||||
"key": "color",
|
||||
"match": {
|
||||
"value": "red"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"exact": true
|
||||
}
|
||||
```
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
```java
|
||||
import static io.qdrant.client.ConditionFactory.matchKeyword;
|
||||
|
||||
import io.qdrant.client.grpc.Points.Filter;
|
||||
|
||||
client
|
||||
.countAsync(
|
||||
"{collection_name}",
|
||||
Filter.newBuilder().addMust(matchKeyword("color", "red")).build(),
|
||||
true)
|
||||
.get();
|
||||
```
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
```python
|
||||
client.count(
|
||||
collection_name="{collection_name}",
|
||||
count_filter=models.Filter(
|
||||
must=[
|
||||
models.FieldCondition(key="color", match=models.MatchValue(value="red")),
|
||||
]
|
||||
),
|
||||
exact=True,
|
||||
)
|
||||
```
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
```rust
|
||||
use qdrant_client::qdrant::{Condition, CountPointsBuilder, Filter};
|
||||
|
||||
client
|
||||
.count(
|
||||
CountPointsBuilder::new("{collection_name}")
|
||||
.filter(Filter::must([Condition::matches(
|
||||
"color",
|
||||
"red".to_string(),
|
||||
)]))
|
||||
.exact(true),
|
||||
)
|
||||
.await?;
|
||||
```
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
```typescript
|
||||
client.count("{collection_name}", {
|
||||
filter: {
|
||||
must: [
|
||||
{
|
||||
key: "color",
|
||||
match: {
|
||||
value: "red",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
exact: true,
|
||||
});
|
||||
```
|
||||
+1
@@ -0,0 +1 @@
|
||||
This code sets up a collection with vectors containing 128 dimensions and a cosine distance metric. It configures the datatype for dense vectors to be Float16, which consumes less memory than Float32 without significant impact on search quality. Additionally, it specifies Float16 as the datatype for sparse text vectors in the collection.
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
```csharp
|
||||
using Qdrant.Client;
|
||||
using Qdrant.Client.Grpc;
|
||||
|
||||
var client = new QdrantClient("localhost", 6334);
|
||||
|
||||
await client.CreateCollectionAsync(
|
||||
collectionName: "{collection_name}",
|
||||
vectorsConfig: new VectorParams {
|
||||
Size = 128,
|
||||
Distance = Distance.Cosine,
|
||||
Datatype = Datatype.Float16
|
||||
},
|
||||
sparseVectorsConfig: (
|
||||
"text",
|
||||
new SparseVectorParams {
|
||||
Index = new SparseIndexConfig {
|
||||
Datatype = Datatype.Float16
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
```
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
```go
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/qdrant/go-client/qdrant"
|
||||
)
|
||||
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
VectorsConfig: qdrant.NewVectorsConfig(&qdrant.VectorParams{
|
||||
Size: 128,
|
||||
Distance: qdrant.Distance_Cosine,
|
||||
Datatype: qdrant.Datatype_Float16.Enum(),
|
||||
}),
|
||||
SparseVectorsConfig: qdrant.NewSparseVectorsConfig(
|
||||
map[string]*qdrant.SparseVectorParams{
|
||||
"text": {
|
||||
Index: &qdrant.SparseIndexConfig{
|
||||
Datatype: qdrant.Datatype_Float16.Enum(),
|
||||
},
|
||||
},
|
||||
}),
|
||||
})
|
||||
```
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
```http
|
||||
PUT /collections/{collection_name}
|
||||
{
|
||||
"vectors": {
|
||||
"size": 128,
|
||||
"distance": "Cosine",
|
||||
"datatype": "float16" // <-- For dense vectors
|
||||
},
|
||||
"sparse_vectors": {
|
||||
"text": {
|
||||
"index": {
|
||||
"datatype": "float16" // <-- And for sparse vectors
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
```java
|
||||
import io.qdrant.client.QdrantClient;
|
||||
import io.qdrant.client.QdrantGrpcClient;
|
||||
import io.qdrant.client.grpc.Collections.CreateCollection;
|
||||
import io.qdrant.client.grpc.Collections.Datatype;
|
||||
import io.qdrant.client.grpc.Collections.Distance;
|
||||
import io.qdrant.client.grpc.Collections.SparseIndexConfig;
|
||||
import io.qdrant.client.grpc.Collections.SparseVectorConfig;
|
||||
import io.qdrant.client.grpc.Collections.SparseVectorParams;
|
||||
import io.qdrant.client.grpc.Collections.VectorParams;
|
||||
import io.qdrant.client.grpc.Collections.VectorsConfig;
|
||||
|
||||
QdrantClient client = new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
|
||||
|
||||
client
|
||||
.createCollectionAsync(
|
||||
CreateCollection.newBuilder()
|
||||
.setCollectionName("{collection_name}")
|
||||
.setVectorsConfig(VectorsConfig.newBuilder()
|
||||
.setParams(VectorParams.newBuilder()
|
||||
.setSize(128)
|
||||
.setDistance(Distance.Cosine)
|
||||
.setDatatype(Datatype.Float16)
|
||||
.build())
|
||||
.build())
|
||||
.setSparseVectorsConfig(
|
||||
SparseVectorConfig.newBuilder()
|
||||
.putMap("text", SparseVectorParams.newBuilder()
|
||||
.setIndex(SparseIndexConfig.newBuilder()
|
||||
.setDatatype(Datatype.Float16)
|
||||
.build())
|
||||
.build()))
|
||||
.build())
|
||||
.get();
|
||||
```
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
```python
|
||||
from qdrant_client import QdrantClient, models
|
||||
|
||||
client = QdrantClient(url="http://localhost:6333")
|
||||
|
||||
client.create_collection(
|
||||
collection_name="{collection_name}",
|
||||
vectors_config=models.VectorParams(
|
||||
size=128,
|
||||
distance=models.Distance.COSINE,
|
||||
datatype=models.Datatype.FLOAT16
|
||||
),
|
||||
sparse_vectors_config={
|
||||
"text": models.SparseVectorParams(
|
||||
index=models.SparseIndexParams(datatype=models.Datatype.FLOAT16)
|
||||
),
|
||||
},
|
||||
)
|
||||
```
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
```rust
|
||||
use qdrant_client::qdrant::{
|
||||
CreateCollectionBuilder, Datatype, Distance, SparseIndexConfigBuilder, SparseVectorParamsBuilder, SparseVectorsConfigBuilder, VectorParamsBuilder
|
||||
};
|
||||
use qdrant_client::Qdrant;
|
||||
|
||||
let client = Qdrant::from_url("http://localhost:6334").build()?;
|
||||
|
||||
let mut sparse_vector_config = SparseVectorsConfigBuilder::default();
|
||||
sparse_vector_config.add_named_vector_params(
|
||||
"text",
|
||||
SparseVectorParamsBuilder::default()
|
||||
.index(SparseIndexConfigBuilder::default().datatype(Datatype::Float32)),
|
||||
);
|
||||
|
||||
let create_collection = CreateCollectionBuilder::new("{collection_name}")
|
||||
.sparse_vectors_config(sparse_vector_config)
|
||||
.vectors_config(
|
||||
VectorParamsBuilder::new(128, Distance::Cosine).datatype(Datatype::Float16),
|
||||
);
|
||||
|
||||
client.create_collection(create_collection).await?;
|
||||
```
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
```typescript
|
||||
import { QdrantClient } from "@qdrant/js-client-rest";
|
||||
|
||||
const client = new QdrantClient({ host: "localhost", port: 6333 });
|
||||
|
||||
client.createCollection("{collection_name}", {
|
||||
vectors: {
|
||||
size: 128,
|
||||
distance: "Cosine",
|
||||
datatype: "float16"
|
||||
},
|
||||
sparse_vectors: {
|
||||
text: {
|
||||
index: {
|
||||
datatype: "float16"
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
When working with vectors in a collection, you can specify the datatype as Uint8 for both dense and sparse vectors. Uint8 represents integer numbers from 0 to 255, which is different from floating-point numbers.
|
||||
|
||||
For dense vectors, make sure the values fall within the range of 0 to 255. If the embeddings generated by your model are not in this range, you will need to quantize the values to convert them.
|
||||
|
||||
Some embedding providers may offer pre-quantized embeddings like Cohere int8 & binary embeddings. If not, you will have to perform quantization yourself.
|
||||
|
||||
It's important to note that while dense vectors must be in the 0 to 255 range, sparse vectors allow for in-flight quantization. This distinction should be considered when handling Uint8 vectors.
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
```csharp
|
||||
using Qdrant.Client;
|
||||
using Qdrant.Client.Grpc;
|
||||
|
||||
var client = new QdrantClient("localhost", 6334);
|
||||
|
||||
await client.CreateCollectionAsync(
|
||||
collectionName: "{collection_name}",
|
||||
vectorsConfig: new VectorParams {
|
||||
Size = 128,
|
||||
Distance = Distance.Cosine,
|
||||
Datatype = Datatype.Uint8
|
||||
},
|
||||
sparseVectorsConfig: (
|
||||
"text",
|
||||
new SparseVectorParams {
|
||||
Index = new SparseIndexConfig {
|
||||
Datatype = Datatype.Uint8
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
```
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
```go
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/qdrant/go-client/qdrant"
|
||||
)
|
||||
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
VectorsConfig: qdrant.NewVectorsConfig(&qdrant.VectorParams{
|
||||
Size: 128,
|
||||
Distance: qdrant.Distance_Cosine,
|
||||
Datatype: qdrant.Datatype_Uint8.Enum(),
|
||||
}),
|
||||
SparseVectorsConfig: qdrant.NewSparseVectorsConfig(
|
||||
map[string]*qdrant.SparseVectorParams{
|
||||
"text": {
|
||||
Index: &qdrant.SparseIndexConfig{
|
||||
Datatype: qdrant.Datatype_Uint8.Enum(),
|
||||
},
|
||||
},
|
||||
}),
|
||||
})
|
||||
```
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
```http
|
||||
PUT /collections/{collection_name}
|
||||
{
|
||||
"vectors": {
|
||||
"size": 128,
|
||||
"distance": "Cosine",
|
||||
"datatype": "uint8" // <-- For dense vectors
|
||||
},
|
||||
"sparse_vectors": {
|
||||
"text": {
|
||||
"index": {
|
||||
"datatype": "uint8" // <-- For sparse vectors
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
```java
|
||||
import io.qdrant.client.QdrantClient;
|
||||
import io.qdrant.client.QdrantGrpcClient;
|
||||
import io.qdrant.client.grpc.Collections.CreateCollection;
|
||||
import io.qdrant.client.grpc.Collections.Datatype;
|
||||
import io.qdrant.client.grpc.Collections.Distance;
|
||||
import io.qdrant.client.grpc.Collections.SparseIndexConfig;
|
||||
import io.qdrant.client.grpc.Collections.SparseVectorConfig;
|
||||
import io.qdrant.client.grpc.Collections.SparseVectorParams;
|
||||
import io.qdrant.client.grpc.Collections.VectorParams;
|
||||
import io.qdrant.client.grpc.Collections.VectorsConfig;
|
||||
|
||||
QdrantClient client = new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
|
||||
|
||||
client
|
||||
.createCollectionAsync(
|
||||
CreateCollection.newBuilder()
|
||||
.setCollectionName("{collection_name}")
|
||||
.setVectorsConfig(VectorsConfig.newBuilder()
|
||||
.setParams(VectorParams.newBuilder()
|
||||
.setSize(128)
|
||||
.setDistance(Distance.Cosine)
|
||||
.setDatatype(Datatype.Uint8)
|
||||
.build())
|
||||
.build())
|
||||
.setSparseVectorsConfig(
|
||||
SparseVectorConfig.newBuilder()
|
||||
.putMap("text", SparseVectorParams.newBuilder()
|
||||
.setIndex(SparseIndexConfig.newBuilder()
|
||||
.setDatatype(Datatype.Uint8)
|
||||
.build())
|
||||
.build()))
|
||||
.build())
|
||||
.get();
|
||||
```
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user