> 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) — API Key authentication via header

## Servers

- `http://localhost:6333` (http, default)
- `https://localhost:6333` (https)

## 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.

## Response

### 200

successful operation

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

## 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.

### 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

### UpdateCollectionParams

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

### UpdateCollectionHnswConfig

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

### UpdateCollectionQuantizationConfig

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

### UpdateCollectionSparseVectors

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

### 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
- `memmap_threshold` (integer, optional, nullable) — Maximum size (in kilobytes) of vectors to store in-memory per segment. Segments larger than this threshold will be stored as read-only memmaped 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
- `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` (integer, optional, nullable) — 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 null - have no limit and choose dynamically to saturate CPU. If 0 - no optimization threads, optimizations will be disabled.

### 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)
- `on_disk_payload` (boolean, optional, nullable) — 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 (in kilobytes) of vectors for additional payload-based indexing. If payload chunk is smaller than `full_scan_threshold_kb` additional indexing won't be used - in this case full-scan search should be preferred by query planner and additional indexing is not required. 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.
- `on_disk` (boolean, optional, nullable) — Store HNSW index on disk. If set to false, the index will be stored in RAM. Default: false
- `payload_m` (integer, optional, nullable) — Custom M param for additional payload-aware HNSW links. If not set, default M will be used.

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "time": 1.1,
  "status": "string",
  "result": true
}
```

**SDK Code**

```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),
)

```

```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());

```

```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?;

```

```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 }
);

```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "http://localhost:6333/collections/collection_name"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```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()
```