upd docs (#4)

This commit is contained in:
Andrey Vasnetsov
2022-02-03 12:18:30 +01:00
committed by GitHub
parent 15c77e73d3
commit 4869d89db7
10 changed files with 238 additions and 183 deletions
+2 -2
View File
@@ -45,9 +45,9 @@ keywords = "search engine, neural network, matching, filter, SaaS, approximate n
gdpr = "We use cookies to learn more about you. At any time you can delete or block cookies through your browser settings." gdpr = "We use cookies to learn more about you. At any time you can delete or block cookies through your browser settings."
githubDocPrefix = "https://github.com/qdrant/docs/tree/master/qdrant/v0.3.x/" githubDocPrefix = "https://github.com/qdrant/docs/tree/master/qdrant/v0.5.x/"
docVersion = "v0.3.x" docVersion = "v0.5.x"
[menu] [menu]
@@ -25,14 +25,12 @@ These settings can be changed at any time by a corresponding request.
With REST API With REST API
``` ```
POST /collections PUT /collections/example_collection
{ {
"create_collection": { "name": "example_collection",
"name": "example_collection", "distance": "Cosine",
"distance": "Cosine", "vector_size": 300
"vector_size": 300
}
} }
``` ```
@@ -42,7 +40,7 @@ In addition to the required options, you can also specify custom values for the
- `wal_config` - `wal_config`
- `optimizers_config` - `optimizers_config`
See [schema definitions](https://qdrant.github.io/qdrant/redoc/index.html#operation/update_collections) and a [configuration file](https://github.com/qdrant/qdrant/blob/master/config/config.yaml) for more information about collection parameters. See [schema definitions](https://qdrant.github.io/qdrant/redoc/index.html#operation/create_collection) and a [configuration file](https://github.com/qdrant/qdrant/blob/master/config/config.yaml) for more information about collection parameters.
<!-- <!--
@@ -57,11 +55,7 @@ See [schema definitions](https://qdrant.github.io/qdrant/redoc/index.html#operat
With REST API With REST API
``` ```
POST /collections DELETE /collections/example_collection
{
"delete_collection": "example_collection"
}
``` ```
<!-- <!--
@@ -79,15 +73,12 @@ With these settings, you can disable indexing during the upload process. And en
As a result, you will not waste extra computation resources on rebuilding the index. As a result, you will not waste extra computation resources on rebuilding the index.
``` ```
POST /collections PATCH /collections/example_collection
{ {
"update_collection": { "optimizers_config": {
"name": "example_collection", "indexing_threshold": 10000
"optimizers_config": { }
"indexing_threshold": 10000
}
}
} }
``` ```
@@ -118,19 +109,17 @@ Since all changes of aliases happen atomically, no concurrent requests will be a
### Crate alias ### Crate alias
``` ```
POST /collections POST /collections/aliases
{ {
"change_aliases": { "actions": [
"actions": [ {
{ "create_alias": {
"create_alias": { "alias_name": "production_collection",
"alias_name": "production_collection", "collection_name": "example_collection"
"collection_name": "example_collection"
}
} }
] }
} ]
} }
``` ```
@@ -145,18 +134,16 @@ POST /collections
### Remove alias ### Remove alias
``` ```
POST /collections POST /collections/aliases
{ {
"change_aliases": { "actions": [
"actions": [ {
{ "delete_alias": {
"delete_alias": { "alias_name": "production_collection"
"alias_name": "production_collection"
}
} }
] }
} ]
} }
``` ```
@@ -174,23 +161,21 @@ For example, you can switch underlying collection with the following command:
``` ```
POST /collections POST /collections/aliases
{ {
"change_aliases": { "actions": [
"actions": [ {
{ "delete_alias": {
"delete_alias": { "alias_name": "production_collection"
"alias_name": "production_collection"
}
},
{
"create_alias": {
"alias_name": "production_collection",
"collection_name": "new_collection"
}
} }
] },
} {
"create_alias": {
"alias_name": "production_collection",
"collection_name": "new_collection"
}
}
]
} }
``` ```
@@ -7,6 +7,10 @@ weight: 50
ToDo ToDo
## Replication
ToDo
## Sharding ## Sharding
ToDo ToDo
@@ -25,10 +25,10 @@ To mark a field as indexable, you can use the following:
REST API REST API
``` ```
POST /collections/{collection_name} PUT /collections/{collection_name}/index
{ {
"create_index": "name_of_the_field_to_index" "field_name": "name_of_the_field_to_index"
} }
``` ```
@@ -48,6 +48,14 @@ The current list of required libraries can be found in the [Dockerfile](https://
Select the minimum set of processor instructions that will be available when using the service. Select the minimum set of processor instructions that will be available when using the service.
The instruction set depends on the hardware at your disposal. The instruction set depends on the hardware at your disposal.
You can enable runtime selection of the architecture at the cost of a slightly bigger binary file size:
```bash
export OPENBLAS_DYNAMIC_ARCH=1
```
Or select specific architecture:
```bash ```bash
export OPENBLAS_TARGET=CORE2 export OPENBLAS_TARGET=CORE2
``` ```
+36 -44
View File
@@ -72,28 +72,26 @@ The filtering process is discussed in detail in the section [Filtering](../filte
With REST API With REST API
``` ```
POST /collections/{collection_name} PUT http://localhost:6333/collections/{collection_name}/points
{ {
"upsert_points": { "points": [
"points": [ {
{ "id": 1,
"id": 1, "vector": [0.05, 0.61, 0.76, 0.74],
"vector": [0.05, 0.61, 0.76, 0.74], "payload": {"city": "Berlin", price: 1.99}
"payload": {"city": "Berlin", price: 1.99} },
}, {
{ "id": 2,
"id": 2, "vector": [0.19, 0.81, 0.75, 0.11],
"vector": [0.19, 0.81, 0.75, 0.11], "payload": {"city": ["Berlin", "London"], price: 1.99}
"payload": {"city": ["Berlin", "London"], price: 1.99} },
}, {
{ "id": 3,
"id": 3, "vector": [0.36, 0.55, 0.47, 0.94],
"vector": [0.36, 0.55, 0.47, 0.94], "payload": {"city": ["Berlin", "Moscow"], price: [1.99, 2.99]}
"payload": {"city": ["Berlin", "Moscow"], price: [1.99, 2.99]} }
} ]
]
}
} }
``` ```
@@ -110,21 +108,19 @@ POST /collections/{collection_name}
### Set payload ### Set payload
REST API ([Schema](https://qdrant.github.io/qdrant/redoc/index.html#operation/update_points)): REST API ([Schema](https://qdrant.github.io/qdrant/redoc/index.html#operation/set_payload)):
``` ```
POST /collections/{collection_name} POST /collections/{collection_name}/points/payload
{ {
"set_payload": { "payload": {
"payload": { "property1": "string",
"property1": "string", "property2": "string"
"property2": "string" },
}, "points": [
"points": [ 0, 3, 100
0, 3, 100 ]
]
}
} }
``` ```
@@ -142,16 +138,14 @@ Python client:
This method removes specified payload keys from specified points This method removes specified payload keys from specified points
REST API ([Schema](https://qdrant.github.io/qdrant/redoc/index.html#operation/update_points)): REST API ([Schema](https://qdrant.github.io/qdrant/redoc/index.html#operation/delete_payload)):
``` ```
POST /collections/{collection_name} POST /collections/{collection_name}/points/payload/delete
{ {
"delete_payload": { "keys": ["color", "price"],
"keys": ["color", "price"], "points": [0, 3, 100]
"points": [0, 3, 100]
}
} }
``` ```
@@ -168,15 +162,13 @@ Python client:
This method removes all payload keys from specified points This method removes all payload keys from specified points
REST API ([Schema](https://qdrant.github.io/qdrant/redoc/index.html#operation/update_points)): REST API ([Schema](https://qdrant.github.io/qdrant/redoc/index.html#operation/clear_payload)):
``` ```
POST /collections/{collection_name} POST /collections/{collection_name}/points/payload/clear
{ {
"clear_payload": { "points": [0, 3, 100]
"points": [0, 3, 100]
}
} }
``` ```
@@ -205,10 +197,10 @@ To mark a field as indexable, you can use the following:
REST API REST API
``` ```
POST /collections/{collection_name} PUT /collections/{collection_name}/index
{ {
"create_index": "name_of_the_field_to_index" "field_name": "name_of_the_field_to_index"
} }
``` ```
+135 -64
View File
@@ -46,6 +46,68 @@ In this case, the API will return the result only after the operation is finishe
} }
``` ```
## Point IDs
Qdrant supports using both `64-bit unsigned integers` and `UUID` as identifiers for points.
Examples of UUID string representations:
* simple: `936DA01F9ABD4d9d80C702AF85C822A8`
* hyphenated: `550e8400-e29b-41d4-a716-446655440000`
* urn: `urn:uuid:F9168C5E-CEB2-4faa-B6BF-329BF39FA1E4`
That means that in every request UUID string could be used instead of numerical id.
Example:
```
PUT /collections/{collection_name}/points
{
"points": [
{
"id": "5c56c793-69f3-4fbf-87e6-c4bf54c28c26",
"payload": {"color": "red"},
"vector": [0.9, 0.1, 0.1]
}
]
}
```
<!--
Python client:
```python
```
-->
and
```
PUT /collections/{collection_name}/points
{
"points": [
{
"id": 1,
"payload": {"color": "red"},
"vector": [0.9, 0.1, 0.1]
}
]
}
```
<!--
Python client:
```python
```
-->
both are possible.
## Upload points ## Upload points
@@ -58,23 +120,21 @@ Internally, these options do not differ and are made only for the convenience of
Create points with REST API : Create points with REST API :
``` ```
POST /collections/{collection_name} PUT /collections/{collection_name}/points
{ {
"upsert_points": { "batch": {
"batch": { "ids": [1, 2, 3],
"ids": [1, 2, 3], "payloads": [
"payloads": [ {"color": "red"},
{"color": "red"}, {"color": "green"},
{"color": "green"}, {"color": "blue"}
{"color": "blue"} ],
], "vectors": [
"vectors": [ [0.9, 0.1, 0.1],
[0.9, 0.1, 0.1], [0.1, 0.9, 0.1],
[0.1, 0.9, 0.1], [0.1, 0.1, 0.9],
[0.1, 0.1, 0.9], ]
]
}
} }
} }
``` ```
@@ -82,28 +142,26 @@ POST /collections/{collection_name}
or record-oriented equivalent: or record-oriented equivalent:
``` ```
POST /collections/{collection_name} PUT /collections/{collection_name}/points
{ {
"upsert_points": { "points": [
"points": [ {
{ "id": 1,
"id": 1, "payload": {"color": "red"},
"payload": {"color": "red"}, "vector": [0.9, 0.1, 0.1]
"vector": [0.9, 0.1, 0.1] },
}, {
{ "id": 2,
"id": 2, "payload": {"color": "green"},
"payload": {"color": "green"}, "vector": [0.1, 0.9, 0.1]
"vector": [0.1, 0.9, 0.1] },
}, {
{ "id": 3,
"id": 3, "payload": {"color": "blue"},
"payload": {"color": "blue"}, "vector": [0.1, 0.1, 0.9]
"vector": [0.1, 0.1, 0.9] },
}, ]
]
}
} }
``` ```
@@ -135,21 +193,19 @@ The second is to modify the payload, for which there are several methods.
#### Set payload #### Set payload
REST API ([Schema](https://qdrant.github.io/qdrant/redoc/index.html#operation/update_points)): REST API ([Schema](https://qdrant.github.io/qdrant/redoc/index.html#operation/set_payload)):
``` ```
POST /collections/{collection_name} POST /collections/{collection_name}/points/payload
{ {
"set_payload": { "payload": {
"payload": { "property1": "string",
"property1": "string", "property2": "string"
"property2": "string" },
}, "points": [
"points": [ 0, 3, 100
0, 3, 100 ]
]
}
} }
``` ```
@@ -164,16 +220,14 @@ Python client:
#### Delete payload keys #### Delete payload keys
REST API ([Schema](https://qdrant.github.io/qdrant/redoc/index.html#operation/update_points)): REST API ([Schema](https://qdrant.github.io/qdrant/redoc/index.html#operation/delete_payload)):
``` ```
POST /collections/{collection_name} POST /collections/{collection_name}/points/payload/delete
{ {
"delete_payload": { "keys": ["color", "price"],
"keys": ["color", "price"], "points": [0, 3, 100]
"points": [0, 3, 100]
}
} }
``` ```
@@ -190,15 +244,13 @@ Python client:
This method removes all payload keys from specified points This method removes all payload keys from specified points
REST API ([Schema](https://qdrant.github.io/qdrant/redoc/index.html#operation/update_points)): REST API ([Schema](https://qdrant.github.io/qdrant/redoc/index.html#operation/clear_payload)):
``` ```
POST /collections/{collection_name} POST /collections/{collection_name}/points/payload/clear
{ {
"clear_payload": { "points": [0, 3, 100]
"points": [0, 3, 100]
}
} }
``` ```
@@ -214,15 +266,13 @@ POST /collections/{collection_name}
## Delete points ## Delete points
REST API ([Schema](https://qdrant.github.io/qdrant/redoc/index.html#operation/update_points)): REST API ([Schema](https://qdrant.github.io/qdrant/redoc/index.html#operation/delete_points)):
``` ```
POST /collections/{collection_name} POST /collections/{collection_name}/points/delete
{ {
"delete_points": { "points": [0, 3, 100]
"ids": [0, 3, 100]
}
} }
``` ```
@@ -235,6 +285,28 @@ POST /collections/{collection_name}
--> -->
Alternative way to specify which points to remove is to use filter.
```
POST /collections/{collection_name}/points/delete
{
"filter": {
"must": [
{
"key": "color"
"match": {
"keyword": "red"
}
}
]
}
}
```
This example removes all points with `{ "color": "red" }` from the collection.
## Retrieve points ## Retrieve points
There is a method for retrieving points by their ids. There is a method for retrieving points by their ids.
@@ -258,7 +330,7 @@ POST /collections/{collection_name}/points
``` ```
--> -->
This method has additional parameters `?with_vector` and `?with_payload`. This method has additional parameters `with_vector` and `with_payload`.
Using these parameters, you can select parts of the point you want as a result. Using these parameters, you can select parts of the point you want as a result.
Excluding helps you not to waste traffic transmitting useless data. Excluding helps you not to waste traffic transmitting useless data.
@@ -300,7 +372,6 @@ POST /collections/{collection_name}/points/scroll
] ]
}, },
"limit": 1, "limit": 1,
"offset": 0,
"with_payload": true, "with_payload": true,
"with_vector": false "with_vector": false
} }
@@ -35,14 +35,11 @@ For additional information please refer to the [API documentation](https://qdran
### Create collection ### Create collection
First - let's create a collection with dot-production metric. First - let's create a collection with dot-production metric.
```bash ```bash
curl -X POST 'http://localhost:6333/collections' \ curl -X PUT 'http://localhost:6333/collections/test_collection' \
-H 'Content-Type: application/json' \ -H 'Content-Type: application/json' \
--data-raw '{ --data-raw '{
"create_collection": { "vector_size": 4,
"name": "test_collection", "distance": "Dot"
"vector_size": 4,
"distance": "Dot"
}
}' }'
``` ```
@@ -90,19 +87,17 @@ Expected response:
Let's now add vectors with some payload: Let's now add vectors with some payload:
```bash ```bash
curl -L -X POST 'http://localhost:6333/collections/test_collection?wait=true' \ curl -L -X PUT 'http://localhost:6333/collections/test_collection/points?wait=true' \
-H 'Content-Type: application/json' \ -H 'Content-Type: application/json' \
--data-raw '{ --data-raw '{
"upsert_points": {
"points": [ "points": [
{"id": 1, "vector": [0.05, 0.61, 0.76, 0.74], "payload": {"city": "Berlin"}}, {"id": 1, "vector": [0.05, 0.61, 0.76, 0.74], "payload": {"city": {"type": "keyword", "value": "Berlin"}}},
{"id": 2, "vector": [0.19, 0.81, 0.75, 0.11], "payload": {"city": ["Berlin", "London"]}}, {"id": 2, "vector": [0.19, 0.81, 0.75, 0.11], "payload": {"city": {"type": "keyword", "value": ["Berlin", "London"] }}},
{"id": 3, "vector": [0.36, 0.55, 0.47, 0.94], "payload": {"city": ["Berlin", "Moscow"]}}, {"id": 3, "vector": [0.36, 0.55, 0.47, 0.94], "payload": {"city": {"type": "keyword", "value": ["Berlin", "Moscow"] }}},
{"id": 4, "vector": [0.18, 0.01, 0.85, 0.80], "payload": {"city": ["London", "Moscow"]}}, {"id": 4, "vector": [0.18, 0.01, 0.85, 0.80], "payload": {"city": {"type": "keyword", "value": ["London", "Moscow"]}}},
{"id": 5, "vector": [0.24, 0.18, 0.22, 0.44], "payload": {"count": 0}}, {"id": 5, "vector": [0.24, 0.18, 0.22, 0.44], "payload": {"count": {"type": "integer", "value": [0]}}},
{"id": 6, "vector": [0.35, 0.08, 0.11, 0.44]} {"id": 6, "vector": [0.35, 0.08, 0.11, 0.44]}
] ]
}
}' }'
``` ```
@@ -43,6 +43,6 @@ In the first step, the data is written to the Write-ahead-log(WAL), which orders
Once a change has been added to the WAL, it will not be lost even if power loss occurs. Once a change has been added to the WAL, it will not be lost even if power loss occurs.
Then the changes go into the segments. Then the changes go into the segments.
Each segment stores the last version of the change applied to it. Each segment stores the last version of the change applied to it as well as version of each individual point.
If the new change has a sequential number less than the current version of the segment, the segment will ignore the change. If the new change has a sequential number less than the current version of the point, the updater will ignore the change.
This mechanism allows Qdrant to safely and efficiently restore the storage from the WAL in case of an abnormal shutdown. This mechanism allows Qdrant to safely and efficiently restore the storage from the WAL in case of an abnormal shutdown.
@@ -5,7 +5,7 @@
<h1> {{ .Params.title | safeHTML }}</h1> <h1> {{ .Params.title | safeHTML }}</h1>
<ul class="bread-crumb clearfix"> <ul class="bread-crumb clearfix">
<li><a href="/"><i class="flaticon-home small"></i> Home</a></li> <li><a href="/"><i class="flaticon-home small"></i> Home</a></li>
{{ $paths := (split .URL "/") }} {{ $paths := (split .RelPermalink "/") }}
{{ $len := sub (len $paths) 2 }} {{ $len := sub (len $paths) 2 }}
{{ range first $len $paths }} {{ range first $len $paths }}
{{ if gt (len . ) 0 }} {{ if gt (len . ) 0 }}