mirror of
https://github.com/qdrant/landing_page.git
synced 2026-09-28 23:48:31 +02:00
v0.8.x docs (#54)
* v0.8.x docs * docs auto-sync * docs auto-sync * update doc sync script * docs auto-sync * docs auto-sync * docs auto-sync Co-authored-by: qdrant <qdrant@users.noreply.github.com>
This commit is contained in:
co-authored by
qdrant
parent
0bf25c9913
commit
cd0cb0f528
@@ -16,6 +16,8 @@ At the first stage, the operation is written to the Write-ahead-log.
|
||||
|
||||
After this moment, the service will not lose the data, even if the machine loses power supply.
|
||||
|
||||
## Awaiting result
|
||||
|
||||
If the API is called with the `&wait=false` parameter, or if it is not explicitly specified, the client will receive an acknowledgment of receiving data:
|
||||
|
||||
```json
|
||||
@@ -59,7 +61,7 @@ Examples of UUID string representations:
|
||||
That means that in every request UUID string could be used instead of numerical id.
|
||||
Example:
|
||||
|
||||
```
|
||||
```http
|
||||
PUT /collections/{collection_name}/points
|
||||
|
||||
{
|
||||
@@ -73,18 +75,29 @@ PUT /collections/{collection_name}/points
|
||||
}
|
||||
```
|
||||
|
||||
<!--
|
||||
|
||||
Python client:
|
||||
|
||||
```python
|
||||
```
|
||||
from qdrant_client import QdrantClient
|
||||
from qdrant_client.http import models
|
||||
|
||||
-->
|
||||
client = QdrantClient(host="localhost", port=6333)
|
||||
|
||||
client.upsert(
|
||||
collection_name="{collection_name}",
|
||||
points=[
|
||||
models.PointStruct(
|
||||
id="5c56c793-69f3-4fbf-87e6-c4bf54c28c26",
|
||||
payload={
|
||||
"color": "red",
|
||||
},
|
||||
vector=[0.9, 0.1, 0.1],
|
||||
),
|
||||
]
|
||||
)
|
||||
```
|
||||
|
||||
and
|
||||
|
||||
```
|
||||
```http
|
||||
PUT /collections/{collection_name}/points
|
||||
|
||||
{
|
||||
@@ -98,16 +111,22 @@ PUT /collections/{collection_name}/points
|
||||
}
|
||||
```
|
||||
|
||||
<!--
|
||||
|
||||
Python client:
|
||||
|
||||
```python
|
||||
client.upsert(
|
||||
collection_name="{collection_name}",
|
||||
points=[
|
||||
models.PointStruct(
|
||||
id=1,
|
||||
payload={
|
||||
"color": "red",
|
||||
},
|
||||
vector=[0.9, 0.1, 0.1],
|
||||
),
|
||||
]
|
||||
)
|
||||
```
|
||||
|
||||
-->
|
||||
|
||||
both are possible.
|
||||
are both possible.
|
||||
|
||||
## Upload points
|
||||
|
||||
@@ -119,7 +138,7 @@ Internally, these options do not differ and are made only for the convenience of
|
||||
|
||||
Create points with REST API :
|
||||
|
||||
```
|
||||
```http
|
||||
PUT /collections/{collection_name}/points
|
||||
|
||||
{
|
||||
@@ -133,15 +152,34 @@ PUT /collections/{collection_name}/points
|
||||
"vectors": [
|
||||
[0.9, 0.1, 0.1],
|
||||
[0.1, 0.9, 0.1],
|
||||
[0.1, 0.1, 0.9],
|
||||
[0.1, 0.1, 0.9]
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```python
|
||||
client.upsert(
|
||||
collection_name="{collection_name}",
|
||||
points=models.Batch(
|
||||
ids=[1, 2, 3],
|
||||
payloads=[
|
||||
{"color": "red"},
|
||||
{"color": "green"},
|
||||
{"color": "blue"},
|
||||
],
|
||||
vectors=[
|
||||
[0.9, 0.1, 0.1],
|
||||
[0.1, 0.9, 0.1],
|
||||
[0.1, 0.1, 0.9],
|
||||
]
|
||||
),
|
||||
)
|
||||
```
|
||||
|
||||
or record-oriented equivalent:
|
||||
|
||||
```
|
||||
```http
|
||||
PUT /collections/{collection_name}/points
|
||||
|
||||
{
|
||||
@@ -165,6 +203,35 @@ PUT /collections/{collection_name}/points
|
||||
}
|
||||
```
|
||||
|
||||
```python
|
||||
client.upsert(
|
||||
collection_name="{collection_name}",
|
||||
points=[
|
||||
models.PointStruct(
|
||||
id=1,
|
||||
payload={
|
||||
"color": "red",
|
||||
},
|
||||
vector=[0.9, 0.1, 0.1],
|
||||
),
|
||||
models.PointStruct(
|
||||
id=2,
|
||||
payload={
|
||||
"color": "green",
|
||||
},
|
||||
vector=[0.1, 0.9, 0.1],
|
||||
),
|
||||
models.PointStruct(
|
||||
id=3,
|
||||
payload={
|
||||
"color": "blue",
|
||||
},
|
||||
vector=[0.1, 0.1, 0.9],
|
||||
),
|
||||
]
|
||||
)
|
||||
```
|
||||
|
||||
<!--
|
||||
|
||||
The Python client has additional features for loading points.
|
||||
@@ -195,7 +262,7 @@ The second is to modify the payload, for which there are several methods.
|
||||
|
||||
REST API ([Schema](https://qdrant.github.io/qdrant/redoc/index.html#operation/set_payload)):
|
||||
|
||||
```
|
||||
```http
|
||||
POST /collections/{collection_name}/points/payload
|
||||
|
||||
{
|
||||
@@ -209,20 +276,22 @@ POST /collections/{collection_name}/points/payload
|
||||
}
|
||||
```
|
||||
|
||||
<!--
|
||||
|
||||
Python client:
|
||||
|
||||
```python
|
||||
```
|
||||
|
||||
-->
|
||||
client.set_payload(
|
||||
collection_name="{collection_name}",
|
||||
payload={
|
||||
"property1": "string",
|
||||
"property2": "string",
|
||||
},
|
||||
points=[0, 3, 10],
|
||||
)
|
||||
```
|
||||
|
||||
#### Delete payload keys
|
||||
|
||||
REST API ([Schema](https://qdrant.github.io/qdrant/redoc/index.html#operation/delete_payload)):
|
||||
|
||||
```
|
||||
```http
|
||||
POST /collections/{collection_name}/points/payload/delete
|
||||
|
||||
{
|
||||
@@ -231,22 +300,21 @@ POST /collections/{collection_name}/points/payload/delete
|
||||
}
|
||||
```
|
||||
|
||||
<!--
|
||||
|
||||
Python client:
|
||||
|
||||
```python
|
||||
client.delete_payload(
|
||||
collection_name="{collection_name}",
|
||||
keys=["color", "price"],
|
||||
points=[0, 3, 100],
|
||||
)
|
||||
```
|
||||
|
||||
-->
|
||||
|
||||
#### Clear payload
|
||||
|
||||
This method removes all payload keys from specified points
|
||||
|
||||
REST API ([Schema](https://qdrant.github.io/qdrant/redoc/index.html#operation/clear_payload)):
|
||||
|
||||
```
|
||||
```http
|
||||
POST /collections/{collection_name}/points/payload/clear
|
||||
|
||||
{
|
||||
@@ -254,21 +322,21 @@ POST /collections/{collection_name}/points/payload/clear
|
||||
}
|
||||
```
|
||||
|
||||
<!--
|
||||
|
||||
Python client:
|
||||
|
||||
```python
|
||||
```
|
||||
|
||||
-->
|
||||
client.clear_payload(
|
||||
collection_name="{collection_name}",
|
||||
points_selector=models.PointIdsList(
|
||||
points=[0, 3, 100],
|
||||
)
|
||||
)
|
||||
```
|
||||
|
||||
## Delete points
|
||||
|
||||
|
||||
REST API ([Schema](https://qdrant.github.io/qdrant/redoc/index.html#operation/delete_points)):
|
||||
|
||||
```
|
||||
```http
|
||||
POST /collections/{collection_name}/points/delete
|
||||
|
||||
{
|
||||
@@ -276,18 +344,18 @@ POST /collections/{collection_name}/points/delete
|
||||
}
|
||||
```
|
||||
|
||||
<!--
|
||||
|
||||
Python client:
|
||||
|
||||
```python
|
||||
client.delete(
|
||||
collection_name="{collection_name}",
|
||||
points_selector=models.PointIdsList(
|
||||
points=[0, 3, 100],
|
||||
),
|
||||
)
|
||||
```
|
||||
|
||||
-->
|
||||
|
||||
Alternative way to specify which points to remove is to use filter.
|
||||
|
||||
```
|
||||
```http
|
||||
POST /collections/{collection_name}/points/delete
|
||||
|
||||
{
|
||||
@@ -304,6 +372,22 @@ POST /collections/{collection_name}/points/delete
|
||||
}
|
||||
```
|
||||
|
||||
```python
|
||||
client.delete(
|
||||
collection_name="{collection_name}",
|
||||
points_selector=models.FilterSelector(
|
||||
filter=models.Filter(
|
||||
must=[
|
||||
models.FieldCondition(
|
||||
key="color",
|
||||
match=models.MatchValue(value="red"),
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
)
|
||||
```
|
||||
|
||||
This example removes all points with `{ "color": "red" }` from the collection.
|
||||
|
||||
|
||||
@@ -314,7 +398,7 @@ There is a method for retrieving points by their ids.
|
||||
|
||||
REST API ([Schema](https://qdrant.github.io/qdrant/redoc/index.html#operation/get_points)):
|
||||
|
||||
```
|
||||
```http
|
||||
POST /collections/{collection_name}/points
|
||||
|
||||
{
|
||||
@@ -322,13 +406,12 @@ POST /collections/{collection_name}/points
|
||||
}
|
||||
```
|
||||
|
||||
<!--
|
||||
|
||||
Python client:
|
||||
|
||||
```python
|
||||
client.retrieve(
|
||||
collection_name="{collection_name}",
|
||||
ids=[0, 3, 10],
|
||||
)
|
||||
```
|
||||
-->
|
||||
|
||||
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.
|
||||
@@ -339,7 +422,7 @@ The single point can also be retrieved via the API:
|
||||
|
||||
REST API ([Schema](https://qdrant.github.io/qdrant/redoc/index.html#operation/get_point)):
|
||||
|
||||
```
|
||||
```http
|
||||
GET /collections/{collection_name}/points/{point_id}
|
||||
```
|
||||
|
||||
@@ -357,7 +440,7 @@ Sometimes it might be necessary to get all stored points without knowing ids, or
|
||||
|
||||
REST API ([Schema](https://qdrant.github.io/qdrant/redoc/index.html#operation/scroll_points)):
|
||||
|
||||
```
|
||||
```http
|
||||
POST /collections/{collection_name}/points/scroll
|
||||
|
||||
{
|
||||
@@ -377,6 +460,23 @@ POST /collections/{collection_name}/points/scroll
|
||||
}
|
||||
```
|
||||
|
||||
```python
|
||||
client.scroll(
|
||||
collection_name="{collection_name}",
|
||||
scroll_filter=models.Filter(
|
||||
must=[
|
||||
models.FieldCondition(
|
||||
key="color",
|
||||
match=models.Match(value="red")
|
||||
),
|
||||
]
|
||||
),
|
||||
limit=1,
|
||||
with_payload=True,
|
||||
with_vector=False,
|
||||
)
|
||||
```
|
||||
|
||||
Returns all point with `color` = `red`.
|
||||
|
||||
```json
|
||||
|
||||
Reference in New Issue
Block a user