updating recommendations to defer indexing

This commit is contained in:
sabrinaaquino
2025-04-10 09:21:38 -03:00
parent 1bb980e517
commit 656ce845cc
@@ -114,7 +114,9 @@ if not client.collection_exists(collection_name):
), ),
optimizers_config=models.OptimizersConfigDiff( optimizers_config=models.OptimizersConfigDiff(
default_segment_number=5, default_segment_number=5,
indexing_threshold=0, ),
hnsw_config=models.HnswConfigDiff(
m=0,
), ),
quantization_config=models.BinaryQuantization( quantization_config=models.BinaryQuantization(
binary=models.BinaryQuantizationConfig(always_ram=True), binary=models.BinaryQuantizationConfig(always_ram=True),
@@ -122,11 +124,11 @@ if not client.collection_exists(collection_name):
) )
``` ```
#### What is happening in the OptimizerConfig? #### What is happening in the HnswConfig?
We're setting `indexing_threshold` to 0 i.e. disabling the indexing to zero. This allows faster uploads of vectors and payloads. We will turn it back on down below, once all the data is loaded We're setting `m` to 0 i.e. disabling the HNSW graph construction. This allows faster uploads of vectors and payloads. We will turn it back on down below, once all the data is loaded.
#### Next, we upload our vectors to this and then enable indexing: #### Next, we upload our vectors to this and then enable the graph construction:
```python ```python
batch_size = 10000 batch_size = 10000
@@ -141,14 +143,14 @@ client.upload_collection(
) )
``` ```
Enable indexing again: Enable HNSW graph construction again:
```python ```python
client.update_collection( client.update_collection(
collection_name=f"{collection_name}", collection_name=f"{collection_name}",
optimizer_config=models.OptimizersConfigDiff( hnsw_config=models.HnswConfigDiff(
indexing_threshold=20000 m=16,
) ,
) )
``` ```
#### Configure the search parameters: #### Configure the search parameters: