LogoLogo
CloudGitHub
  • API Reference
CloudGitHub
API ReferenceCollections

PUT
/collections/:collection_name
PUT
/collections/:collection_name
1# Create a collection with default dense vector
2curl -X PUT \
3 'http://localhost:6333/collections/collection_name' \
4 --header 'api-key: <api-key-value>' \
5 --header 'Content-Type: application/json' \
6 --data-raw '{
7 "vectors": {
8 "size": 384,
9 "distance": "Cosine"
10 }
11}'
12
13# Create a collection with named dense and sparse vectors
14curl -X PUT \
15 'http://localhost:6333/collections/collection_name' \
16 --header 'api-key: <api-key-value>' \
17 --header 'Content-Type: application/json' \
18 --data-raw '{
19 "vectors": {
20 "dense-vector-name": {
21 "size": 1536,
22 "distance": "Cosine"
23 }
24 },
25 "sparse_vectors": {
26 "sparse-vector-name": {
27 "index": {
28 "on_disk": true
29 }
30 }
31 }
32}'
Try it
200Updated
1{
2 "usage": {
3 "cpu": 1,
4 "io_read": 1,
5 "io_write": 1
6 },
7 "time": 0.002,
8 "status": "ok",
9 "result": true
10}
Creates a new collection with the given parameters.
Was this page helpful?
Previous

Delete a collection

Next
Built with
Delete a collection
Creates a new collection with the given parameters.

Path parameters

collection_namestringRequired
Name of the new collection

Headers

api-keystringRequired

Query parameters

timeoutintegerOptional
Wait for operation commit timeout in seconds. If timeout is reached - request will return with service error.

Request

Parameters of a new collection
vectorsobject or map from strings to objectsOptional

Vector params separator for single and multiple vector modes Single mode:

{ “size”: 128, “distance”: “Cosine” }

or multiple mode:

{ “default”: { “size”: 128, “distance”: “Cosine” } }

shard_numberuint or nullOptional
For auto sharding: Number of shards in collection. - Default is 1 for standalone, otherwise equal to the number of nodes - Minimum is 1 For custom sharding: Number of shards in collection per shard group. - Default is 1, meaning that each shard key will be mapped to a single shard - Minimum is 1
sharding_methodenum or anyOptional
Sharding method Default is Auto - points are distributed across all available shards Custom - points are distributed across shards according to shard key
replication_factoruint or nullOptional
Number of shards replicas. Default is 1 Minimum is 1
write_consistency_factoruint or nullOptional
Defines how many replicas should apply the operation for us to consider it successful. Increasing this number will make the collection more resilient to inconsistencies, but will also make it fail if not enough replicas are available. Does not have any performance impact.
on_disk_payloadboolean or nullOptional
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. Default: true
hnsw_configobject or anyOptional
Custom params for HNSW index. If none - values from service configuration file are used.
wal_configobject or anyOptional
Custom params for WAL. If none - values from service configuration file are used.
optimizers_configobject or anyOptional
Custom params for Optimizers. If none - values from service configuration file are used.
init_fromobject or anyOptional
Specify other collection to copy data from.
quantization_configobject or anyOptional
Quantization parameters. If none - quantization is disabled.
sparse_vectorsmap from strings to objects or nullOptional
Sparse vector data config.
strict_mode_configobject or anyOptional
Strict-mode config.

Response

successful operation
usageobject or any or null
timedouble or null
Time spent to process this request
statusstring or null
resultboolean or null
Create a collection

For auto sharding: Number of shards in collection. - Default is 1 for standalone, otherwise equal to the number of nodes - Minimum is 1

For custom sharding: Number of shards in collection per shard group. - Default is 1, meaning that each shard key will be mapped to a single shard - Minimum is 1

Sharding method Default is Auto - points are distributed across all available shards Custom - points are distributed across shards according to shard key

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.

Default: true

Custom params for HNSW index. If none - values from service configuration file are used.

Custom params for WAL. If none - values from service configuration file are used.

Custom params for Optimizers. If none - values from service configuration file are used.

Quantization parameters. If none - quantization is disabled.

Strict-mode config.

Wait for operation commit timeout in seconds. If timeout is reached - request will return with service error.