mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-10 21:38:30 +02:00
Document new strict_mode_config parameters (v1.18.0) (#2303)
* Document 7 missing strict_mode_config parameters Adds documentation sections and code snippets (Python, TypeScript, Rust, Go, Java, C#, HTTP, bash) for search_allow_exact, search_max_hnsw_ef, search_max_oversampling, search_max_batchsize, max_resident_memory_percent, multivector_config, and sparse_config. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Use title case for all headers * Update qdrant-landing/content/documentation/ops-configuration/administration.md Co-authored-by: Tim Visée <tim@visee.me> * Mention default strict mode on Cloud; Clarify behavior of only setting enabled=true * Apply suggestion from @timvisee Co-authored-by: Tim Visée <tim@visee.me> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Tim Visée <tim@visee.me>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
Tim Visée
parent
dc7d66545e
commit
ecd4887576
+1
@@ -0,0 +1 @@
|
||||
This code snippet sets `sparse_config` on the strict mode configuration to cap the maximum length of sparse vectors for a named vector.
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
curl -X PUT http://localhost:6333/collections/{collection_name} \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"strict_mode_config": {
|
||||
"enabled": true,
|
||||
"sparse_config": {
|
||||
"{vector_name}": {
|
||||
"max_length": 1000
|
||||
}
|
||||
}
|
||||
}
|
||||
}'
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
using Qdrant.Client;
|
||||
using Qdrant.Client.Grpc;
|
||||
|
||||
public class Snippet
|
||||
{
|
||||
public static async Task Run()
|
||||
{
|
||||
var client = new QdrantClient("localhost", 6334);
|
||||
|
||||
await client.CreateCollectionAsync(
|
||||
collectionName: "{collection_name}",
|
||||
strictModeConfig: new StrictModeConfig
|
||||
{
|
||||
Enabled = true,
|
||||
SparseConfig = new StrictModeSparseConfig
|
||||
{
|
||||
SparseConfig = { ["{vector_name}"] = new StrictModeSparse { MaxLength = 1000 } }
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
```bash
|
||||
curl -X PUT http://localhost:6333/collections/{collection_name} \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"strict_mode_config": {
|
||||
"enabled": true,
|
||||
"sparse_config": {
|
||||
"{vector_name}": {
|
||||
"max_length": 1000
|
||||
}
|
||||
}
|
||||
}
|
||||
}'
|
||||
```
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
```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,
|
||||
SparseConfig = new StrictModeSparseConfig
|
||||
{
|
||||
SparseConfig = { ["{vector_name}"] = new StrictModeSparse { MaxLength = 1000 } }
|
||||
}
|
||||
}
|
||||
);
|
||||
```
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
```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: qdrant.PtrOf(true),
|
||||
SparseConfig: &qdrant.StrictModeSparseConfig{
|
||||
SparseConfig: map[string]*qdrant.StrictModeSparse{
|
||||
"{vector_name}": {MaxLength: qdrant.PtrOf(uint64(1000))},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
```
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
```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;
|
||||
import io.qdrant.client.grpc.Collections.StrictModeSparse;
|
||||
import io.qdrant.client.grpc.Collections.StrictModeSparseConfig;
|
||||
|
||||
QdrantClient client =
|
||||
new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
|
||||
|
||||
client
|
||||
.createCollectionAsync(
|
||||
CreateCollection.newBuilder()
|
||||
.setCollectionName("{collection_name}")
|
||||
.setStrictModeConfig(
|
||||
StrictModeConfig.newBuilder()
|
||||
.setEnabled(true)
|
||||
.setSparseConfig(
|
||||
StrictModeSparseConfig.newBuilder()
|
||||
.putSparseConfig("{vector_name}", StrictModeSparse.newBuilder().setMaxLength(1000).build())
|
||||
.build())
|
||||
.build())
|
||||
.build())
|
||||
.get();
|
||||
```
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
```python
|
||||
from qdrant_client import QdrantClient, models
|
||||
|
||||
client = QdrantClient(url="http://localhost:6333")
|
||||
|
||||
client.create_collection(
|
||||
collection_name="{collection_name}",
|
||||
strict_mode_config=models.StrictModeConfig(
|
||||
enabled=True,
|
||||
sparse_config={"{vector_name}": models.StrictModeSparse(max_length=1000)},
|
||||
),
|
||||
)
|
||||
```
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
```rust
|
||||
use std::collections::HashMap;
|
||||
|
||||
use qdrant_client::Qdrant;
|
||||
use qdrant_client::qdrant::{
|
||||
CreateCollectionBuilder, StrictModeConfigBuilder, StrictModeSparse, StrictModeSparseConfig,
|
||||
};
|
||||
|
||||
let client = Qdrant::from_url("http://localhost:6334").build()?;
|
||||
|
||||
client
|
||||
.create_collection(
|
||||
CreateCollectionBuilder::new("{collection_name}").strict_mode_config(
|
||||
StrictModeConfigBuilder::default()
|
||||
.enabled(true)
|
||||
.sparse_config(StrictModeSparseConfig {
|
||||
sparse_config: HashMap::from([(
|
||||
"{vector_name}".to_string(),
|
||||
StrictModeSparse {
|
||||
max_length: Some(1000),
|
||||
},
|
||||
)]),
|
||||
}),
|
||||
),
|
||||
)
|
||||
.await?;
|
||||
```
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
```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,
|
||||
sparse_config: {
|
||||
"{vector_name}": {
|
||||
max_length: 1000,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
```
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package snippet
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/qdrant/go-client/qdrant"
|
||||
)
|
||||
|
||||
func Main() {
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
if err != nil { panic(err) } // @hide
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
StrictModeConfig: &qdrant.StrictModeConfig{
|
||||
Enabled: qdrant.PtrOf(true),
|
||||
SparseConfig: &qdrant.StrictModeSparseConfig{
|
||||
SparseConfig: map[string]*qdrant.StrictModeSparse{
|
||||
"{vector_name}": {MaxLength: qdrant.PtrOf(uint64(1000))},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
```http
|
||||
PUT /collections/{collection_name}
|
||||
{
|
||||
"strict_mode_config": {
|
||||
"enabled": true,
|
||||
"sparse_config": {
|
||||
"{vector_name}": {
|
||||
"max_length": 1000
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.example.snippets_amalgamation;
|
||||
|
||||
import io.qdrant.client.QdrantClient;
|
||||
import io.qdrant.client.QdrantGrpcClient;
|
||||
import io.qdrant.client.grpc.Collections.CreateCollection;
|
||||
import io.qdrant.client.grpc.Collections.StrictModeConfig;
|
||||
import io.qdrant.client.grpc.Collections.StrictModeSparse;
|
||||
import io.qdrant.client.grpc.Collections.StrictModeSparseConfig;
|
||||
|
||||
public class Snippet {
|
||||
public static void run() throws Exception {
|
||||
QdrantClient client =
|
||||
new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
|
||||
|
||||
client
|
||||
.createCollectionAsync(
|
||||
CreateCollection.newBuilder()
|
||||
.setCollectionName("{collection_name}")
|
||||
.setStrictModeConfig(
|
||||
StrictModeConfig.newBuilder()
|
||||
.setEnabled(true)
|
||||
.setSparseConfig(
|
||||
StrictModeSparseConfig.newBuilder()
|
||||
.putSparseConfig("{vector_name}", StrictModeSparse.newBuilder().setMaxLength(1000).build())
|
||||
.build())
|
||||
.build())
|
||||
.build())
|
||||
.get();
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
from qdrant_client import QdrantClient, models
|
||||
|
||||
client = QdrantClient(url="http://localhost:6333")
|
||||
|
||||
client.create_collection(
|
||||
collection_name="{collection_name}",
|
||||
strict_mode_config=models.StrictModeConfig(
|
||||
enabled=True,
|
||||
sparse_config={"{vector_name}": models.StrictModeSparse(max_length=1000)},
|
||||
),
|
||||
)
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use qdrant_client::Qdrant;
|
||||
use qdrant_client::qdrant::{
|
||||
CreateCollectionBuilder, StrictModeConfigBuilder, StrictModeSparse, StrictModeSparseConfig,
|
||||
};
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
let client = Qdrant::from_url("http://localhost:6334").build()?;
|
||||
|
||||
client
|
||||
.create_collection(
|
||||
CreateCollectionBuilder::new("{collection_name}").strict_mode_config(
|
||||
StrictModeConfigBuilder::default()
|
||||
.enabled(true)
|
||||
.sparse_config(StrictModeSparseConfig {
|
||||
sparse_config: HashMap::from([(
|
||||
"{vector_name}".to_string(),
|
||||
StrictModeSparse {
|
||||
max_length: Some(1000),
|
||||
},
|
||||
)]),
|
||||
}),
|
||||
),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
import { QdrantClient } from "@qdrant/js-client-rest";
|
||||
|
||||
const client = new QdrantClient({ host: "localhost", port: 6333 });
|
||||
|
||||
client.createCollection("{collection_name}", {
|
||||
strict_mode_config: {
|
||||
enabled: true,
|
||||
sparse_config: {
|
||||
"{vector_name}": {
|
||||
max_length: 1000,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user