mirror of
https://github.com/qdrant/landing_page.git
synced 2026-09-28 15:38:33 +02:00
multilang snippet to review
This commit is contained in:
@@ -741,7 +741,7 @@ client, err := qdrant.NewClient(&qdrant.Config{
|
||||
})
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_namee}",
|
||||
CollectionName: "{collection_name}",
|
||||
SparseVectorsConfig: qdrant.NewSparseVectorsConfig(
|
||||
map[string]*qdrant.SparseVectorParams{
|
||||
"text": {},
|
||||
@@ -778,7 +778,7 @@ Upon crossing a limit, the server will return a client side error with the infor
|
||||
|
||||
As part of the config, the `enabled` field act as a toggle to enable or disable the strict mode dynamically.
|
||||
|
||||
The `strict_mode_config` can be enabled when creating a collection.
|
||||
The `strict_mode_config` can be enabled when creating a collection, for instance below to active the `unindexed_filtering_retrieve` limit.
|
||||
|
||||
```http
|
||||
PUT /collections/{collection_name}
|
||||
@@ -790,6 +790,107 @@ PUT /collections/{collection_name}
|
||||
}
|
||||
```
|
||||
|
||||
```bash
|
||||
curl -X PUT http://localhost:6333/collections/{collection_name} \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"strict_mode_config": {
|
||||
"enabled":" true,
|
||||
"unindexed_filtering_retrieve": true
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
```python
|
||||
from qdrant_client import QdrantClient, models
|
||||
|
||||
client = QdrantClient(url="http://localhost:6333")
|
||||
|
||||
client.create_collection(
|
||||
collection_name="{collection_name}",
|
||||
strict_mode_config=models.SparseVectorParams{ enabled=True, unindexed_filtering_retrieve=True },
|
||||
)
|
||||
```
|
||||
|
||||
```typescript
|
||||
import { QdrantClient } from "@qdrant/js-client-rest";
|
||||
|
||||
const client = new QdrantClient({ host: "localhost", port: 6333 });
|
||||
|
||||
client.createCollection("{collection_name}", {
|
||||
strict_mode_config: {
|
||||
enabled: true,
|
||||
unindexed_filtering_retrieve: true,
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
```rust
|
||||
use qdrant_client::Qdrant;
|
||||
use qdrant_client::qdrant::{CreateCollectionBuilder, StrictModeConfigBuilder};
|
||||
|
||||
let client = Qdrant::from_url("http://localhost:6334").build()?;
|
||||
|
||||
client
|
||||
.create_collection(
|
||||
CreateCollectionBuilder::new("{collection_name}")
|
||||
.strict_config_mode(StrictModeConfigBuilder::default().enabled(true).unindexed_filtering_retrieve(true)),
|
||||
)
|
||||
.await?;
|
||||
```
|
||||
|
||||
```java
|
||||
import io.qdrant.client.QdrantClient;
|
||||
import io.qdrant.client.QdrantGrpcClient;
|
||||
import io.qdrant.client.grpc.Collections.CreateCollection;
|
||||
import io.qdrant.client.grpc.Collections.StrictModeCOnfig;
|
||||
|
||||
QdrantClient client =
|
||||
new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
|
||||
|
||||
client
|
||||
.createCollectionAsync(
|
||||
CreateCollection.newBuilder()
|
||||
.setCollectionName("{collection_name}")
|
||||
.setStrictModeConfig(
|
||||
StrictModeConfig.newBuilder().setEnabled(true).setUnindexedFilteringRetrieve(true).build())
|
||||
.build())
|
||||
.get();
|
||||
```
|
||||
|
||||
```csharp
|
||||
using Qdrant.Client;
|
||||
using Qdrant.Client.Grpc;
|
||||
|
||||
var client = new QdrantClient("localhost", 6334);
|
||||
|
||||
await client.CreateCollectionAsync(
|
||||
collectionName: "{collection_name}",
|
||||
strictModeConfig: new StrictModeConfig { enabled = true, unindexed_filtering_retrieve = true }
|
||||
);
|
||||
```
|
||||
|
||||
```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}",
|
||||
StrictModeConfig: &qdrant.StrictModeConfig{
|
||||
Enabled: true,
|
||||
IndexingThreshold: true,
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
or enabled later on an existing collection.
|
||||
|
||||
```http
|
||||
@@ -802,6 +903,91 @@ PATCH /collections/{collection_name}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
```bash
|
||||
curl -X PATCH http://localhost:6333/collections/{collection_name} \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"strict_mode_config": {
|
||||
"enabled": true,
|
||||
"unindexed_filtering_retrieve": true
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
```python
|
||||
client.update_collection(
|
||||
collection_name="{collection_name}",
|
||||
strict_mode_config=models.StrictModeConfig(enabled=True, unindexed_filtering_retrieve=True),
|
||||
)
|
||||
```
|
||||
|
||||
```typescript
|
||||
client.updateCollection("{collection_name}", {
|
||||
strict_mode_config: {
|
||||
enabled: true,
|
||||
unindexed_filtering_retrieve: true,
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
```rust
|
||||
use qdrant_client::qdrant::{StrictModeConfigBuilder, UpdateCollectionBuilder};
|
||||
|
||||
client
|
||||
.update_collection(
|
||||
UpdateCollectionBuilder::new("{collection_name}").strict_mode_config(
|
||||
StrictModeConfigBuilder::default().enabled(true).unindexed_filtering_retrieve(true),
|
||||
),
|
||||
)
|
||||
.await?;
|
||||
```
|
||||
|
||||
```java
|
||||
import io.qdrant.client.grpc.Collections.StrictModeConfigBuilder;
|
||||
import io.qdrant.client.grpc.Collections.UpdateCollection;
|
||||
|
||||
client.updateCollectionAsync(
|
||||
UpdateCollection.newBuilder()
|
||||
.setCollectionName("{collection_name}")
|
||||
.setStrictModeConfig(
|
||||
StrictModeConfig.newBuilder().setEnabled(true).setUnindexedFilteringRetrieve(true).build())
|
||||
.build());
|
||||
```
|
||||
|
||||
```csharp
|
||||
using Qdrant.Client;
|
||||
using Qdrant.Client.Grpc;
|
||||
|
||||
var client = new QdrantClient("localhost", 6334);
|
||||
|
||||
await client.UpdateCollectionAsync(
|
||||
collectionName: "{collection_name}",
|
||||
strictModeConfig: new StrictModeConfig { enabled = true, unindexed_filtering_retrieve = true }
|
||||
);
|
||||
```
|
||||
|
||||
```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}",
|
||||
StrictModeConfig: &qdrant.StrictModeConfig{
|
||||
Enabled: true,
|
||||
IndexingThreshold: true,
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
It can be disabled on an existing collection.
|
||||
|
||||
```http
|
||||
@@ -813,6 +999,87 @@ PATCH /collections/{collection_name}
|
||||
}
|
||||
```
|
||||
|
||||
```bash
|
||||
curl -X PATCH http://localhost:6333/collections/{collection_name} \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"strict_mode_config": {
|
||||
"enabled": false,
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
```python
|
||||
client.update_collection(
|
||||
collection_name="{collection_name}",
|
||||
strict_mode_config=models.StrictModeConfig(enabled=False),
|
||||
)
|
||||
```
|
||||
|
||||
```typescript
|
||||
client.updateCollection("{collection_name}", {
|
||||
strict_mode_config: {
|
||||
enabled: false,
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
```rust
|
||||
use qdrant_client::qdrant::{StrictModeConfigBuilder, UpdateCollectionBuilder};
|
||||
|
||||
client
|
||||
.update_collection(
|
||||
UpdateCollectionBuilder::new("{collection_name}").strict_mode_config(
|
||||
StrictModeConfigBuilder::default().enabled(false),
|
||||
),
|
||||
)
|
||||
.await?;
|
||||
```
|
||||
|
||||
```java
|
||||
import io.qdrant.client.grpc.Collections.StrictModeConfigBuilder;
|
||||
import io.qdrant.client.grpc.Collections.UpdateCollection;
|
||||
|
||||
client.updateCollectionAsync(
|
||||
UpdateCollection.newBuilder()
|
||||
.setCollectionName("{collection_name}")
|
||||
.setStrictModeConfig(
|
||||
StrictModeConfig.newBuilder().setEnabled(false).build())
|
||||
.build());
|
||||
```
|
||||
|
||||
```csharp
|
||||
using Qdrant.Client;
|
||||
using Qdrant.Client.Grpc;
|
||||
|
||||
var client = new QdrantClient("localhost", 6334);
|
||||
|
||||
await client.UpdateCollectionAsync(
|
||||
collectionName: "{collection_name}",
|
||||
strictModeConfig: new StrictModeConfig { enabled = false }
|
||||
);
|
||||
```
|
||||
|
||||
```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}",
|
||||
StrictModeConfig: &qdrant.StrictModeConfig{
|
||||
Enabled: false,
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
### Check collection existence
|
||||
|
||||
*Available as of v1.8.0*
|
||||
|
||||
Reference in New Issue
Block a user