> This page is for version v1.19.x.
> For other versions, use one of these documentation indexes:
> - v1.20.x (default): https://api.qdrant.tech/v-1-20-x/llms.txt
> - v1.19.x: https://api.qdrant.tech/v-1-19-x/llms.txt
> - v1.18.x: https://api.qdrant.tech/v-1-18-x/llms.txt
> - v1.17.x: https://api.qdrant.tech/v-1-17-x/llms.txt
> - v1.16.x: https://api.qdrant.tech/v-1-16-x/llms.txt
> - v1.15.x: https://api.qdrant.tech/v-1-15-x/llms.txt
> - v1.14.x: https://api.qdrant.tech/v-1-14-x/llms.txt
> - v1.13.x: https://api.qdrant.tech/v-1-13-x/llms.txt
> - v1.12.x: https://api.qdrant.tech/v-1-12-x/llms.txt
> - v1.11.x: https://api.qdrant.tech/v-1-11-x/llms.txt
> - v1.10.x: https://api.qdrant.tech/v-1-10-x/llms.txt
> - v1.9.x: https://api.qdrant.tech/v-1-9-x/llms.txt
> - master: https://api.qdrant.tech/master/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://api.qdrant.tech/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://api.qdrant.tech/_mcp/server.

# Update collection parameters

PATCH http://localhost:6333/collections/{collection_name}
Content-Type: application/json

Updates the parameters of the specified collection.

Reference: https://api.qdrant.tech/api-reference/collections/update-collection

## Authentication

- `api-key` header (required) — Authorization key, either read-write or read-only
- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `collection_name` (string, required) — Name of the collection to update

### Query parameters

- `timeout` (integer, optional) — Wait for operation commit timeout in seconds. If timeout is reached - request will return with service error.

### Body (application/json)

This endpoint expects an UpdateCollection.

- `vectors` (UpdateCollectionVectors, optional) — Map of vector data parameters to update for each named vector. To update parameters in a collection having a single unnamed vector, use an empty string as name.
- `optimizers_config` (UpdateCollectionOptimizersConfig, optional) — Custom params for Optimizers. If none - it is left unchanged. This operation is blocking, it will only proceed once all current optimizations are complete
- `params` (UpdateCollectionParams, optional) — Collection base params. If none - it is left unchanged.
- `hnsw_config` (UpdateCollectionHnswConfig, optional) — HNSW parameters to update for the collection index. If none - it is left unchanged.
- `quantization_config` (UpdateCollectionQuantizationConfig, optional) — Quantization parameters to update. If none - it is left unchanged.
- `sparse_vectors` (UpdateCollectionSparseVectors, optional) — Map of sparse vector data parameters to update for each sparse vector.
- `strict_mode_config` (UpdateCollectionStrictModeConfig, optional)
- `metadata` (UpdateCollectionMetadata, optional) — Metadata to update for the collection. If provided, this will merge with existing metadata. Individual keys can be removed by setting their value to `null`.

## Response

### 200

successful operation

- `usage` (CollectionsCollectionNamePatchResponsesContentApplicationJsonSchemaUsage, optional)
- `time` (float, optional) — Time spent to process this request
- `status` (string, optional)
- `result` (boolean, optional)

## Errors

### 400 Client Request Error

error

- `time` (float, optional) — Time spent to process this request
- `status` (ErrorResponseStatus, optional)
- `result` (ErrorResponseResult, optional, nullable)

## Types

### UpdateCollectionVectors

Map of vector data parameters to update for each named vector. To update parameters in a collection having a single unnamed vector, use an empty string as name.

- VectorsConfigDiff: map from string to VectorParamsDiff
- any

### UpdateCollectionOptimizersConfig

Custom params for Optimizers. If none - it is left unchanged. This operation is blocking, it will only proceed once all current optimizations are complete

- OptimizersConfigDiff: OptimizersConfigDiff
- any

### UpdateCollectionParams

Collection base params. If none - it is left unchanged.

- CollectionParamsDiff: CollectionParamsDiff
- any

### UpdateCollectionHnswConfig

HNSW parameters to update for the collection index. If none - it is left unchanged.

- HnswConfigDiff: HnswConfigDiff
- any

### UpdateCollectionQuantizationConfig

Quantization parameters to update. If none - it is left unchanged.

- QuantizationConfigDiff: QuantizationConfigDiff
- any

### UpdateCollectionSparseVectors

Map of sparse vector data parameters to update for each sparse vector.

- SparseVectorsConfig: map from string to SparseVectorParams
- any

### UpdateCollectionStrictModeConfig

- StrictModeConfig: StrictModeConfig
- any

### UpdateCollectionMetadata

Metadata to update for the collection. If provided, this will merge with existing metadata. Individual keys can be removed by setting their value to `null`.

- Payload: map from string to any
- any

### CollectionsCollectionNamePatchResponsesContentApplicationJsonSchemaUsage

- Usage: Usage
- any

### ErrorResponseStatus

- `error` (string, optional) — Description of the occurred error.

### ErrorResponseResult

### VectorParamsDiff

- `hnsw_config` (VectorParamsDiffHnswConfig, optional) — Update params for HNSW index. If empty object - it will be unset.
- `quantization_config` (VectorParamsDiffQuantizationConfig, optional) — Update params for quantization. If none - it is left unchanged.
- `memory` (VectorParamsDiffMemory, optional) — Memory placement of the original vector storage. Overrides the deprecated `on_disk` flag if both are set. `pinned` is not supported for dense vector storage.
- `on_disk` (boolean, optional, nullable, deprecated) — Deprecated: use `memory` instead. If true, vectors are served from disk, improving RAM usage at the cost of latency

### OptimizersConfigDiff

- `deleted_threshold` (double, optional, nullable) — The minimal fraction of deleted vectors in a segment, required to perform segment optimization
- `vacuum_min_vector_number` (integer, optional, nullable) — The minimal number of vectors in a segment, required to perform segment optimization
- `default_segment_number` (integer, optional, nullable) — Target amount of segments optimizer will try to keep. Real amount of segments may vary depending on multiple parameters: - Amount of stored points - Current write RPS It is recommended to select default number of segments as a factor of the number of search threads, so that each segment would be handled evenly by one of the threads If `default_segment_number = 0`, will be automatically selected by the number of available CPUs
- `max_segment_size` (integer, optional, nullable) — Do not create segments larger this size (in kilobytes). Large segments might require disproportionately long indexation times, therefore it makes sense to limit the size of segments. If indexation speed have more priority for your - make this parameter lower. If search speed is more important - make this parameter higher. Note: 1Kb = 1 vector of size 256
- `indexing_threshold` (integer, optional, nullable) — Maximum size (in kilobytes) of vectors allowed for plain index, exceeding this threshold will enable vector indexing Default value is 20,000, based on \<[https://github.com/google-research/google-research/blob/master/scann/docs/algorithms.md>](https://github.com/google-research/google-research/blob/master/scann/docs/algorithms.md>). To disable vector indexing, set to `0`. Note: 1kB = 1 vector of size 256.
- `flush_interval_sec` (uint64, optional, nullable) — Minimum interval between forced flushes.
- `max_optimization_threads` (OptimizersConfigDiffMaxOptimizationThreads, optional) — Max number of threads (jobs) for running optimizations per shard. Note: each optimization job will also use `max_indexing_threads` threads by itself for index building. If "auto" - have no limit and choose dynamically to saturate CPU. If 0 - no optimization threads, optimizations will be disabled.
- `prevent_unoptimized` (boolean, optional, nullable) — If enabled, the service will try to prevent the creation of large unoptimized segments. When enabled, new points written to segments larger than the indexing threshold are stored as "deferred points": they are persisted in the WAL and segments, but excluded from read/search results until the corresponding segments are optimized (e.g. indexed, quantized, or moved to mmap storage). Update requests with `wait=true` will only return after the deferred points become visible, which may significantly increase the perceived latency between submitting an update and its completion. Update requests with `wait=false` are not affected. Default is disabled.
- `memmap_threshold` (integer, optional, nullable, deprecated) — Maximum size (in kilobytes) of vectors to store in-memory per segment. Segments larger than this threshold will be stored as read-only memmapped file. Memmap storage is disabled by default, to enable it, set this threshold to a reasonable value. To disable memmap storage, set this to `0`. Note: 1Kb = 1 vector of size 256 Deprecated since Qdrant 1.15.0

### CollectionParamsDiff

- `replication_factor` (uint, optional, nullable) — Number of replicas for each shard
- `write_consistency_factor` (uint, optional, nullable) — Minimal number successful responses from replicas to consider operation successful
- `read_fan_out_factor` (uint, optional, nullable) — Fan-out every read request to these many additional remote nodes (and return first available response)
- `read_fan_out_delay_ms` (uint64, optional, nullable) — Delay in milliseconds before sending read requests to remote nodes
- `payload` (CollectionParamsDiffPayload, optional) — Update params of the payload storage. If none - it is left unchanged.
- `on_disk_payload` (boolean, optional, nullable, deprecated) — Deprecated: use `payload.memory` instead. If true - point's payload will not be stored in memory. It will be read from the disk every time it is requested. This setting saves RAM by (slightly) increasing the response time. Note: those payload values that are involved in filtering and are indexed - remain in RAM.

### HnswConfigDiff

- `m` (integer, optional, nullable) — Number of edges per node in the index graph. Larger the value - more accurate the search, more space required.
- `ef_construct` (integer, optional, nullable) — Number of neighbours to consider during the index building. Larger the value - more accurate the search, more time required to build the index.
- `full_scan_threshold` (integer, optional, nullable) — Minimal size threshold (in KiloBytes) below which full-scan is preferred over HNSW search. This measures the total size of vectors being queried against. When the maximum estimated amount of points that a condition satisfies is smaller than `full_scan_threshold_kb`, the query planner will use full-scan search instead of HNSW index traversal for better performance. Note: 1Kb = 1 vector of size 256
- `max_indexing_threads` (integer, optional, nullable) — Number of parallel threads used for background index building. If 0 - automatically select from 8 to 16. Best to keep between 8 and 16 to prevent likelihood of building broken/inefficient HNSW graphs. On small CPUs, less threads are used.
- `memory` (HnswConfigDiffMemory, optional) — Memory placement of the HNSW graph. Overrides the deprecated `on_disk` flag if both are set. Default: `cached` (`cold` if `on_disk` is set to true).
- `payload_m` (integer, optional, nullable) — Custom M param for additional payload-aware HNSW links. If not set, default M will be used.
- `inline_storage` (boolean, optional, nullable) — Store copies of original and quantized vectors within the HNSW index file. Default: false. Enabling this option will trade the search speed for disk usage by reducing amount of random seeks during the search. Requires quantized vectors to be enabled. Multi-vectors are not supported.
- `on_disk` (boolean, optional, nullable, deprecated) — Deprecated: use `memory` instead. Store HNSW index on disk. If set to false, the index will be stored in RAM. Default: false

### QuantizationConfigDiff

- ScalarQuantization: ScalarQuantization
- ProductQuantization: ProductQuantization
- BinaryQuantization: BinaryQuantization
- TurboQuantization: TurboQuantization
- Disabled: enum
  - Allowed values: `Disabled`

### SparseVectorParams

Params of single sparse vector data storage

- `index` (SparseVectorParamsIndex, optional) — Custom params for index. If none - values from collection configuration are used.
- `modifier` (SparseVectorParamsModifier, optional) — Configures addition value modifications for sparse vectors. Default: none

### StrictModeConfig

- `enabled` (boolean, optional, nullable) — Whether strict mode is enabled for a collection or not.
- `max_query_limit` (integer, optional, nullable) — Max allowed `limit` parameter for all APIs that don't have their own max limit.
- `max_timeout` (integer, optional, nullable) — Max allowed `timeout` parameter.
- `unindexed_filtering_retrieve` (boolean, optional, nullable) — Allow usage of unindexed fields in retrieval based (e.g. search) filters.
- `unindexed_filtering_update` (boolean, optional, nullable) — Allow usage of unindexed fields in filtered updates (e.g. delete by payload).
- `search_max_hnsw_ef` (integer, optional, nullable) — Max HNSW ef value allowed in search parameters.
- `search_allow_exact` (boolean, optional, nullable) — Whether exact search is allowed.
- `search_max_oversampling` (double, optional, nullable) — Max oversampling value allowed in search.
- `upsert_max_batchsize` (integer, optional, nullable) — Max batchsize when upserting
- `search_max_batchsize` (integer, optional, nullable) — Max batchsize when searching
- `max_collection_vector_size_bytes` (integer, optional, nullable) — Max size of a collections vector storage in bytes, ignoring replicas.
- `read_rate_limit` (integer, optional, nullable) — Max number of read operations per minute per replica
- `write_rate_limit` (integer, optional, nullable) — Max number of write operations per minute per replica
- `max_collection_payload_size_bytes` (integer, optional, nullable) — Max size of a collections payload storage in bytes
- `max_points_count` (integer, optional, nullable) — Max number of points estimated in a collection
- `filter_max_conditions` (integer, optional, nullable) — Max conditions a filter can have.
- `condition_max_size` (integer, optional, nullable) — Max size of a condition, eg. items in `MatchAny`.
- `multivector_config` (StrictModeConfigMultivectorConfig, optional) — Multivector strict mode configuration
- `sparse_config` (StrictModeConfigSparseConfig, optional) — Sparse vector strict mode configuration
- `max_payload_index_count` (integer, optional, nullable) — Max number of payload indexes in a collection
- `max_resident_memory_percent` (integer, optional, nullable, deprecated) — Deprecated: use the node-wide quota config (`PUT /quotas`) instead, which caps the same resource for every collection. Scheduled for removal in 1.21. Reject memory-consuming update operations (e.g. upsert, set payload) when the process resident memory exceeds this percentage of total system memory (or cgroup limit). Value in [1, 100]. Memory is a node-wide resource, so this only tightens the quota for one collection; it cannot lift it. Delete operations are not affected, so callers can still free memory.

### Usage

Usage of the hardware resources, spent to process the request

- `hardware` (UsageHardware, optional)
- `inference` (UsageInference, optional)

### VectorParamsDiffHnswConfig

Update params for HNSW index. If empty object - it will be unset.

- HnswConfigDiff: HnswConfigDiff
- any

### VectorParamsDiffQuantizationConfig

Update params for quantization. If none - it is left unchanged.

- QuantizationConfigDiff: QuantizationConfigDiff
- any

### VectorParamsDiffMemory

Memory placement of the original vector storage. Overrides the deprecated `on_disk` flag if both are set. `pinned` is not supported for dense vector storage.

- Memory: enum
  - Allowed values: `cold`, `cached`, `pinned`
- any

### OptimizersConfigDiffMaxOptimizationThreads

Max number of threads (jobs) for running optimizations per shard. Note: each optimization job will also use `max_indexing_threads` threads by itself for index building. If "auto" - have no limit and choose dynamically to saturate CPU. If 0 - no optimization threads, optimizations will be disabled.

- MaxOptimizationThreads: MaxOptimizationThreads
- any

### CollectionParamsDiffPayload

Update params of the payload storage. If none - it is left unchanged.

- PayloadStorageParams: PayloadStorageParams
- any

### HnswConfigDiffMemory

Memory placement of the HNSW graph. Overrides the deprecated `on_disk` flag if both are set. Default: `cached` (`cold` if `on_disk` is set to true).

- Memory: enum
  - Allowed values: `cold`, `cached`, `pinned`
- any

### ScalarQuantization

- `scalar` (ScalarQuantizationConfig, required)

### ProductQuantization

- `product` (ProductQuantizationConfig, required)

### BinaryQuantization

- `binary` (BinaryQuantizationConfig, required)

### TurboQuantization

- `turbo` (TurboQuantQuantizationConfig, required)

### SparseVectorParamsIndex

Custom params for index. If none - values from collection configuration are used.

- SparseIndexParams: SparseIndexParams
- any

### SparseVectorParamsModifier

Configures addition value modifications for sparse vectors. Default: none

- Modifier: enum
  - Allowed values: `none`, `idf`
- any

### StrictModeConfigMultivectorConfig

Multivector strict mode configuration

- StrictModeMultivectorConfig: map from string to StrictModeMultivector
- any

### StrictModeConfigSparseConfig

Sparse vector strict mode configuration

- StrictModeSparseConfig: map from string to StrictModeSparse
- any

### UsageHardware

- HardwareUsage: HardwareUsage
- any

### UsageInference

- InferenceUsage: InferenceUsage
- any

### MaxOptimizationThreads

- MaxOptimizationThreadsSetting: enum
  - Allowed values: `auto`
- integer

### PayloadStorageParams

Params of the payload storage

- `memory` (PayloadStorageParamsMemory, optional) — Memory placement of the payload storage. Overrides the deprecated `on_disk_payload` flag if both are set. `pinned` is not supported for payload storage. Default: `cold` (`cached` if `on_disk_payload` is set to false).

### ScalarQuantizationConfig

- `type` (enum, required)
  - Allowed values: `int8`
- `quantile` (float, optional, nullable) — Quantile for quantization. Expected value range in [0.5, 1.0]. If not set - use the whole range of values
- `memory` (ScalarQuantizationConfigMemory, optional) — Memory placement of quantized vectors. Overrides the deprecated `always_ram` flag if both are set. Default: follow the memory placement of the original vector storage.
- `always_ram` (boolean, optional, nullable, deprecated) — Deprecated: use `memory` instead. If true - quantized vectors always will be stored in RAM, ignoring the config of main storage

### ProductQuantizationConfig

- `compression` (enum, required)
  - Allowed values: `x4`, `x8`, `x16`, `x32`, `x64`
- `memory` (ProductQuantizationConfigMemory, optional) — Memory placement of quantized vectors. Overrides the deprecated `always_ram` flag if both are set. Default: follow the memory placement of the original vector storage.
- `always_ram` (boolean, optional, nullable, deprecated) — Deprecated: use `memory` instead.

### BinaryQuantizationConfig

- `memory` (BinaryQuantizationConfigMemory, optional) — Memory placement of quantized vectors. Overrides the deprecated `always_ram` flag if both are set. Default: follow the memory placement of the original vector storage.
- `encoding` (BinaryQuantizationConfigEncoding, optional)
- `query_encoding` (BinaryQuantizationConfigQueryEncoding, optional) — Asymmetric quantization configuration allows a query to have different quantization than stored vectors. It can increase the accuracy of search at the cost of performance.
- `always_ram` (boolean, optional, nullable, deprecated) — Deprecated: use `memory` instead.

### TurboQuantQuantizationConfig

- `memory` (TurboQuantQuantizationConfigMemory, optional) — Memory placement of quantized vectors. Overrides the deprecated `always_ram` flag if both are set. Default: follow the memory placement of the original vector storage.
- `bits` (TurboQuantQuantizationConfigBits, optional)
- `always_ram` (boolean, optional, nullable, deprecated) — Deprecated: use `memory` instead.

### SparseIndexParams

Configuration for sparse inverted index.

- `full_scan_threshold` (integer, optional, nullable) — We prefer a full scan search upto (excluding) this number of vectors. Note: this is number of vectors, not KiloBytes.
- `memory` (SparseIndexParamsMemory, optional) — Memory placement of the index. Overrides the deprecated `on_disk` flag if both are set. Default: `pinned` (`cold` if `on_disk` is set to true).
- `datatype` (SparseIndexParamsDatatype, optional) — Defines which datatype should be used for the index. Choosing different datatypes allows to optimize memory usage and performance vs accuracy. - For `float32` datatype - vectors are stored as single-precision floating point numbers, 4 bytes. - For `float16` datatype - vectors are stored as half-precision floating point numbers, 2 bytes. - For `uint8` datatype - vectors are quantized to unsigned 8-bit integers, 1 byte. Quantization to fit byte range `[0, 255]` happens during indexing automatically, so the actual vector data does not need to conform to this range.
- `on_disk` (boolean, optional, nullable, deprecated) — Deprecated: use `memory` instead. Store index on disk. If set to false, the index will be stored in RAM. Default: false

### StrictModeMultivector

- `max_vectors` (integer, optional, nullable) — Max number of vectors in a multivector

### StrictModeSparse

- `max_length` (integer, optional, nullable) — Max length of sparse vector

### HardwareUsage

Usage of the hardware resources, spent to process the request

- `cpu` (integer, required)
- `payload_io_read` (integer, required)
- `payload_io_write` (integer, required)
- `payload_index_io_read` (integer, required)
- `payload_index_io_write` (integer, required)
- `vector_io_read` (integer, required)
- `vector_io_write` (integer, required)

### InferenceUsage

- `models` (map from string to ModelUsage, required)

### PayloadStorageParamsMemory

Memory placement of the payload storage. Overrides the deprecated `on_disk_payload` flag if both are set. `pinned` is not supported for payload storage. Default: `cold` (`cached` if `on_disk_payload` is set to false).

- Memory: enum
  - Allowed values: `cold`, `cached`, `pinned`
- any

### ScalarQuantizationConfigMemory

Memory placement of quantized vectors. Overrides the deprecated `always_ram` flag if both are set. Default: follow the memory placement of the original vector storage.

- Memory: enum
  - Allowed values: `cold`, `cached`, `pinned`
- any

### ProductQuantizationConfigMemory

Memory placement of quantized vectors. Overrides the deprecated `always_ram` flag if both are set. Default: follow the memory placement of the original vector storage.

- Memory: enum
  - Allowed values: `cold`, `cached`, `pinned`
- any

### BinaryQuantizationConfigMemory

Memory placement of quantized vectors. Overrides the deprecated `always_ram` flag if both are set. Default: follow the memory placement of the original vector storage.

- Memory: enum
  - Allowed values: `cold`, `cached`, `pinned`
- any

### BinaryQuantizationConfigEncoding

- BinaryQuantizationEncoding: enum
  - Allowed values: `one_bit`, `two_bits`, `one_and_half_bits`
- any

### BinaryQuantizationConfigQueryEncoding

Asymmetric quantization configuration allows a query to have different quantization than stored vectors. It can increase the accuracy of search at the cost of performance.

- BinaryQuantizationQueryEncoding: enum
  - Allowed values: `default`, `binary`, `scalar4bits`, `scalar8bits`
- any

### TurboQuantQuantizationConfigMemory

Memory placement of quantized vectors. Overrides the deprecated `always_ram` flag if both are set. Default: follow the memory placement of the original vector storage.

- Memory: enum
  - Allowed values: `cold`, `cached`, `pinned`
- any

### TurboQuantQuantizationConfigBits

- TurboQuantBitSize: enum
  - Allowed values: `bits1`, `bits1_5`, `bits2`, `bits4`
- any

### SparseIndexParamsMemory

Memory placement of the index. Overrides the deprecated `on_disk` flag if both are set. Default: `pinned` (`cold` if `on_disk` is set to true).

- Memory: enum
  - Allowed values: `cold`, `cached`, `pinned`
- any

### SparseIndexParamsDatatype

Defines which datatype should be used for the index. Choosing different datatypes allows to optimize memory usage and performance vs accuracy. - For `float32` datatype - vectors are stored as single-precision floating point numbers, 4 bytes. - For `float16` datatype - vectors are stored as half-precision floating point numbers, 2 bytes. - For `uint8` datatype - vectors are quantized to unsigned 8-bit integers, 1 byte. Quantization to fit byte range `[0, 255]` happens during indexing automatically, so the actual vector data does not need to conform to this range.

- Datatype: enum
  - Allowed values: `float32`, `uint8`, `float16`, `turbo4`
- any

### ModelUsage

- `tokens` (uint64, required)

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "usage": {
    "hardware": {
      "cpu": 1,
      "payload_index_io_read": 1,
      "payload_index_io_write": 1,
      "payload_io_read": 1,
      "payload_io_write": 1,
      "vector_io_read": 1,
      "vector_io_write": 1
    },
    "inference": {
      "models": {}
    }
  },
  "time": 0.002,
  "status": "ok",
  "result": true
}
```

**SDK Code**

```java
import static io.qdrant.client.ShardKeyFactory.shardKey;

import io.qdrant.client.QdrantClient;
import io.qdrant.client.QdrantGrpcClient;

import io.qdrant.client.grpc.Collections.OptimizersConfigDiff;
import io.qdrant.client.grpc.Collections.UpdateCollection;

QdrantClient client = new QdrantClient(
                QdrantGrpcClient.newBuilder("localhost", 6334, false).build());

client.updateCollectionAsync(
    UpdateCollection.newBuilder()
        .setCollectionName("{collection_name}")
        .setOptimizersConfig(
            OptimizersConfigDiff.newBuilder().setIndexingThreshold(10000).build())
        .build());

```

```go
package client

import (
	"context"

	"github.com/qdrant/go-client/qdrant"
)

func updateCollection() {
	client, err := qdrant.NewClient(&qdrant.Config{
		Host: "localhost",
		Port: 6334,
	})
	if err != nil {
		panic(err)
	}

	threshold := uint64(10000)
	err = client.UpdateCollection(context.Background(), &qdrant.UpdateCollection{
		CollectionName: "{collection_name}",
		OptimizersConfig: &qdrant.OptimizersConfigDiff{
			IndexingThreshold: &threshold,
		},
	})
	if err != nil {
		panic(err)
	}
}

```

```csharp
using Qdrant.Client;
using Qdrant.Client.Grpc;

var client = new QdrantClient("localhost", 6334);

await client.UpdateCollectionAsync(
  collectionName: "{collection_name}",
  optimizersConfig: new OptimizersConfigDiff { IndexingThreshold = 10000 }
);

```

```typescript
import { QdrantClient } from "@qdrant/js-client-rest";

const client = new QdrantClient({ host: "localhost", port: 6333 });

client.updateCollection("{collection_name}", {
  optimizers_config: {
    indexing_threshold: 10000,
  },
});

```

```rust
use qdrant_client::qdrant::{OptimizersConfigDiffBuilder, UpdateCollectionBuilder};
use qdrant_client::Qdrant;

let client = Qdrant::from_url("http://localhost:6334").build()?;

client
    .update_collection(
        UpdateCollectionBuilder::new("{collection_name}").optimizers_config(
            OptimizersConfigDiffBuilder::default().indexing_threshold(10_000),
        ),
    )
    .await?;

```

```python
from qdrant_client import QdrantClient

client = QdrantClient(url="http://localhost:6333")

client.update_collection(
    collection_name="{collection_name}",
    optimizer_config=models.OptimizersConfigDiff(indexing_threshold=10000),
)

```

```ruby
require 'uri'
require 'net/http'

url = URI("http://localhost:6333/collections/collection_name")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Patch.new(url)
request["api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'http://localhost:6333/collections/collection_name', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
    'api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```swift
import Foundation

let headers = [
  "api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:6333/collections/collection_name")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```