mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-09 12:58:31 +02:00
Increase payload indexing advice visibility (#2360)
* Add new 'Create a Payload Index' section * Add indexing tip to low latency search, search, and filtering docs * Add bash code snippet * Edits * Update qdrant-landing/content/documentation/manage-data/indexing.md Co-authored-by: Tim Visée <tim@visee.me> --------- Co-authored-by: Tim Visée <tim@visee.me>
This commit is contained in:
co-authored by
Tim Visée
parent
2b97750ade
commit
cf94245089
+14
@@ -0,0 +1,14 @@
|
||||
# @block-start get-current-value
|
||||
BASE_EF=$(curl -s http://localhost:6333/collections/{collection_name} | \
|
||||
jq '.result.config.hnsw_config.ef_construct')
|
||||
# @block-end get-current-value
|
||||
|
||||
# @block-start update-collection
|
||||
curl -X PATCH http://localhost:6333/collections/{collection_name} \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw "{
|
||||
\"hnsw_config\": {
|
||||
\"ef_construct\": $((BASE_EF + 1))
|
||||
}
|
||||
}"
|
||||
# @block-end update-collection
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
using Qdrant.Client; // @hide
|
||||
using Qdrant.Client.Grpc; // @hide
|
||||
|
||||
public class Snippet
|
||||
{
|
||||
public static async Task Run()
|
||||
{
|
||||
var client = new QdrantClient("localhost", 6334); // @hide
|
||||
|
||||
// @block-start get-current-value
|
||||
var collectionInfo = await client.GetCollectionInfoAsync("{collection_name}");
|
||||
var baseEf = collectionInfo.Config.HnswConfig.EfConstruct;
|
||||
// @block-end get-current-value
|
||||
|
||||
// @block-start update-collection
|
||||
await client.UpdateCollectionAsync(
|
||||
collectionName: "{collection_name}",
|
||||
hnswConfig: new HnswConfigDiff { EfConstruct = baseEf + 1 }
|
||||
);
|
||||
// @block-end update-collection
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
```bash
|
||||
BASE_EF=$(curl -s http://localhost:6333/collections/{collection_name} | \
|
||||
jq '.result.config.hnsw_config.ef_construct')
|
||||
|
||||
curl -X PATCH http://localhost:6333/collections/{collection_name} \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw "{
|
||||
\"hnsw_config\": {
|
||||
\"ef_construct\": $((BASE_EF + 1))
|
||||
}
|
||||
}"
|
||||
```
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
```csharp
|
||||
var collectionInfo = await client.GetCollectionInfoAsync("{collection_name}");
|
||||
var baseEf = collectionInfo.Config.HnswConfig.EfConstruct;
|
||||
|
||||
await client.UpdateCollectionAsync(
|
||||
collectionName: "{collection_name}",
|
||||
hnswConfig: new HnswConfigDiff { EfConstruct = baseEf + 1 }
|
||||
);
|
||||
```
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
```bash
|
||||
BASE_EF=$(curl -s http://localhost:6333/collections/{collection_name} | \
|
||||
jq '.result.config.hnsw_config.ef_construct')
|
||||
```
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
```csharp
|
||||
var collectionInfo = await client.GetCollectionInfoAsync("{collection_name}");
|
||||
var baseEf = collectionInfo.Config.HnswConfig.EfConstruct;
|
||||
```
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
```go
|
||||
collectionInfo, err := client.GetCollectionInfo(context.Background(), "{collection_name}")
|
||||
if err != nil { panic(err) }
|
||||
baseEf := *collectionInfo.Config.HnswConfig.EfConstruct
|
||||
```
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
```java
|
||||
CollectionInfo collectionInfo = client.getCollectionInfoAsync("{collection_name}").get();
|
||||
long baseEf = collectionInfo.getConfig().getHnswConfig().getEfConstruct();
|
||||
```
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
```python
|
||||
base_ef = client.get_collection(
|
||||
collection_name="{collection_name}"
|
||||
).config.hnsw_config.ef_construct
|
||||
```
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
```rust
|
||||
let base_ef = client
|
||||
.collection_info("{collection_name}")
|
||||
.await?
|
||||
.result
|
||||
.and_then(|info| info.config)
|
||||
.and_then(|config| config.hnsw_config)
|
||||
.and_then(|hnsw| hnsw.ef_construct);
|
||||
```
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
```typescript
|
||||
const collectionInfo = await client.getCollection("{collection_name}");
|
||||
const baseEf = collectionInfo.config.hnsw_config.ef_construct;
|
||||
```
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
```go
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/qdrant/go-client/qdrant"
|
||||
)
|
||||
|
||||
collectionInfo, err := client.GetCollectionInfo(context.Background(), "{collection_name}")
|
||||
if err != nil { panic(err) }
|
||||
baseEf := *collectionInfo.Config.HnswConfig.EfConstruct
|
||||
|
||||
client.UpdateCollection(context.Background(), &qdrant.UpdateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
HnswConfig: &qdrant.HnswConfigDiff{
|
||||
EfConstruct: qdrant.PtrOf(baseEf + 1),
|
||||
},
|
||||
})
|
||||
```
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
```java
|
||||
import io.qdrant.client.grpc.Collections.CollectionInfo;
|
||||
import io.qdrant.client.grpc.Collections.HnswConfigDiff;
|
||||
import io.qdrant.client.grpc.Collections.UpdateCollection;
|
||||
|
||||
CollectionInfo collectionInfo = client.getCollectionInfoAsync("{collection_name}").get();
|
||||
long baseEf = collectionInfo.getConfig().getHnswConfig().getEfConstruct();
|
||||
|
||||
client
|
||||
.updateCollectionAsync(
|
||||
UpdateCollection.newBuilder()
|
||||
.setCollectionName("{collection_name}")
|
||||
.setHnswConfig(
|
||||
HnswConfigDiff.newBuilder()
|
||||
.setEfConstruct(baseEf + 1)
|
||||
.build())
|
||||
.build())
|
||||
.get();
|
||||
```
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
```python
|
||||
base_ef = client.get_collection(
|
||||
collection_name="{collection_name}"
|
||||
).config.hnsw_config.ef_construct
|
||||
|
||||
client.update_collection(
|
||||
collection_name="{collection_name}",
|
||||
hnsw_config=models.HnswConfigDiff(ef_construct=base_ef + 1),
|
||||
)
|
||||
```
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
```rust
|
||||
use qdrant_client::qdrant::{HnswConfigDiffBuilder, UpdateCollectionBuilder};
|
||||
|
||||
let base_ef = client
|
||||
.collection_info("{collection_name}")
|
||||
.await?
|
||||
.result
|
||||
.and_then(|info| info.config)
|
||||
.and_then(|config| config.hnsw_config)
|
||||
.and_then(|hnsw| hnsw.ef_construct);
|
||||
|
||||
client
|
||||
.update_collection(
|
||||
UpdateCollectionBuilder::new("{collection_name}")
|
||||
.hnsw_config(HnswConfigDiffBuilder::default().ef_construct(base_ef.unwrap_or(100) + 1)),
|
||||
)
|
||||
.await?;
|
||||
```
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
```typescript
|
||||
const collectionInfo = await client.getCollection("{collection_name}");
|
||||
const baseEf = collectionInfo.config.hnsw_config.ef_construct;
|
||||
|
||||
await client.updateCollection("{collection_name}", {
|
||||
hnsw_config: {
|
||||
ef_construct: baseEf + 1,
|
||||
},
|
||||
});
|
||||
```
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
```bash
|
||||
curl -X PATCH http://localhost:6333/collections/{collection_name} \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw "{
|
||||
\"hnsw_config\": {
|
||||
\"ef_construct\": $((BASE_EF + 1))
|
||||
}
|
||||
}"
|
||||
```
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
```csharp
|
||||
await client.UpdateCollectionAsync(
|
||||
collectionName: "{collection_name}",
|
||||
hnswConfig: new HnswConfigDiff { EfConstruct = baseEf + 1 }
|
||||
);
|
||||
```
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
```go
|
||||
client.UpdateCollection(context.Background(), &qdrant.UpdateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
HnswConfig: &qdrant.HnswConfigDiff{
|
||||
EfConstruct: qdrant.PtrOf(baseEf + 1),
|
||||
},
|
||||
})
|
||||
```
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
```java
|
||||
client
|
||||
.updateCollectionAsync(
|
||||
UpdateCollection.newBuilder()
|
||||
.setCollectionName("{collection_name}")
|
||||
.setHnswConfig(
|
||||
HnswConfigDiff.newBuilder()
|
||||
.setEfConstruct(baseEf + 1)
|
||||
.build())
|
||||
.build())
|
||||
.get();
|
||||
```
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
```python
|
||||
client.update_collection(
|
||||
collection_name="{collection_name}",
|
||||
hnsw_config=models.HnswConfigDiff(ef_construct=base_ef + 1),
|
||||
)
|
||||
```
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
```rust
|
||||
client
|
||||
.update_collection(
|
||||
UpdateCollectionBuilder::new("{collection_name}")
|
||||
.hnsw_config(HnswConfigDiffBuilder::default().ef_construct(base_ef.unwrap_or(100) + 1)),
|
||||
)
|
||||
.await?;
|
||||
```
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
```typescript
|
||||
await client.updateCollection("{collection_name}", {
|
||||
hnsw_config: {
|
||||
ef_construct: baseEf + 1,
|
||||
},
|
||||
});
|
||||
```
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package snippet
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/qdrant/go-client/qdrant"
|
||||
)
|
||||
|
||||
func Main() {
|
||||
// @hide-start
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
if err != nil { panic(err) }
|
||||
// @hide-end
|
||||
|
||||
// @block-start get-current-value
|
||||
collectionInfo, err := client.GetCollectionInfo(context.Background(), "{collection_name}")
|
||||
if err != nil { panic(err) }
|
||||
baseEf := *collectionInfo.Config.HnswConfig.EfConstruct
|
||||
// @block-end get-current-value
|
||||
|
||||
// @block-start update-collection
|
||||
client.UpdateCollection(context.Background(), &qdrant.UpdateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
HnswConfig: &qdrant.HnswConfigDiff{
|
||||
EfConstruct: qdrant.PtrOf(baseEf + 1),
|
||||
},
|
||||
})
|
||||
// @block-end update-collection
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.example.snippets_amalgamation;
|
||||
|
||||
import io.qdrant.client.grpc.Collections.CollectionInfo;
|
||||
import io.qdrant.client.grpc.Collections.HnswConfigDiff;
|
||||
import io.qdrant.client.grpc.Collections.UpdateCollection;
|
||||
|
||||
public class Snippet {
|
||||
public static void run() throws Exception {
|
||||
// @hide-start
|
||||
io.qdrant.client.QdrantClient client =
|
||||
new io.qdrant.client.QdrantClient(io.qdrant.client.QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
|
||||
// @hide-end
|
||||
|
||||
// @block-start get-current-value
|
||||
CollectionInfo collectionInfo = client.getCollectionInfoAsync("{collection_name}").get();
|
||||
long baseEf = collectionInfo.getConfig().getHnswConfig().getEfConstruct();
|
||||
// @block-end get-current-value
|
||||
|
||||
// @block-start update-collection
|
||||
client
|
||||
.updateCollectionAsync(
|
||||
UpdateCollection.newBuilder()
|
||||
.setCollectionName("{collection_name}")
|
||||
.setHnswConfig(
|
||||
HnswConfigDiff.newBuilder()
|
||||
.setEfConstruct(baseEf + 1)
|
||||
.build())
|
||||
.build())
|
||||
.get();
|
||||
// @block-end update-collection
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
from qdrant_client import QdrantClient, models # @hide
|
||||
|
||||
client = QdrantClient(url="http://localhost:6333") # @hide
|
||||
|
||||
# @block-start get-current-value
|
||||
base_ef = client.get_collection(
|
||||
collection_name="{collection_name}"
|
||||
).config.hnsw_config.ef_construct
|
||||
# @block-end get-current-value
|
||||
|
||||
# @block-start update-collection
|
||||
client.update_collection(
|
||||
collection_name="{collection_name}",
|
||||
hnsw_config=models.HnswConfigDiff(ef_construct=base_ef + 1),
|
||||
)
|
||||
# @block-end update-collection
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
use qdrant_client::qdrant::{HnswConfigDiffBuilder, UpdateCollectionBuilder};
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
let client = qdrant_client::Qdrant::from_url("http://localhost:6334").build()?; // @hide
|
||||
|
||||
// @block-start get-current-value
|
||||
let base_ef = client
|
||||
.collection_info("{collection_name}")
|
||||
.await?
|
||||
.result
|
||||
.and_then(|info| info.config)
|
||||
.and_then(|config| config.hnsw_config)
|
||||
.and_then(|hnsw| hnsw.ef_construct);
|
||||
// @block-end get-current-value
|
||||
|
||||
// @block-start update-collection
|
||||
client
|
||||
.update_collection(
|
||||
UpdateCollectionBuilder::new("{collection_name}")
|
||||
.hnsw_config(HnswConfigDiffBuilder::default().ef_construct(base_ef.unwrap_or(100) + 1)),
|
||||
)
|
||||
.await?;
|
||||
// @block-end update-collection
|
||||
|
||||
Ok(())
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
import { QdrantClient } from "@qdrant/js-client-rest"; // @hide
|
||||
|
||||
const client = new QdrantClient({ host: "localhost", port: 6333 }); // @hide
|
||||
|
||||
// @block-start get-current-value
|
||||
const collectionInfo = await client.getCollection("{collection_name}");
|
||||
const baseEf = collectionInfo.config.hnsw_config.ef_construct;
|
||||
// @block-end get-current-value
|
||||
|
||||
// @block-start update-collection
|
||||
await client.updateCollection("{collection_name}", {
|
||||
hnsw_config: {
|
||||
ef_construct: baseEf + 1,
|
||||
},
|
||||
});
|
||||
// @block-end update-collection
|
||||
Reference in New Issue
Block a user