docs auto-sync

This commit is contained in:
qdrant
2022-07-05 11:14:20 +00:00
parent 71aa76dc40
commit 2f2fa68579
4 changed files with 117 additions and 17 deletions
@@ -60,11 +60,11 @@ client.scroll(
must=[
models.FieldCondition(
key="city",
match=models.Match(value="London"),
match=models.MatchValue(value="London"),
),
models.FieldCondition(
key="color",
match=models.Match(value="red"),
match=models.MatchValue(value="red"),
),
]
),
@@ -108,11 +108,11 @@ client.scroll(
should=[
models.FieldCondition(
key="city",
match=models.Match(value="London"),
match=models.MatchValue(value="London"),
),
models.FieldCondition(
key="color",
match=models.Match(value="red"),
match=models.MatchValue(value="red"),
),
]
),
@@ -159,11 +159,11 @@ client.scroll(
must_not=[
models.FieldCondition(
key="city",
match=models.Match(value="London")
match=models.MatchValue(value="London")
),
models.FieldCondition(
key="color",
match=models.Match(value="red")
match=models.MatchValue(value="red")
),
]
),
@@ -210,13 +210,13 @@ client.scroll(
must=[
models.FieldCondition(
key="city",
match=models.Match(value="London")
match=models.MatchValue(value="London")
),
],
must_not=[
models.FieldCondition(
key="color",
match=models.Match(value="red")
match=models.MatchValue(value="red")
),
],
),
@@ -263,11 +263,11 @@ client.scroll(
must=[
models.FieldCondition(
key="city",
match=models.Match(value="London")
match=models.MatchValue(value="London")
),
models.FieldCondition(
key="color",
match=models.Match(value="red")
match=models.MatchValue(value="red")
),
],
),
+56 -1
View File
@@ -467,7 +467,7 @@ client.scroll(
must=[
models.FieldCondition(
key="color",
match=models.Match(value="red")
match=models.MatchValue(value="red")
),
]
),
@@ -510,3 +510,58 @@ Python client:
```
-->
## Counting points
*Avalable since v0.8.4*
Sometimes it can be useful to know how many points fit the filter conditions without doing a real search.
Among others, for example, we can highlight the following scenarios:
* Evaluation of results size for faceted search
* Determining the number of pages for pagination
* Debugging the query execution speed
REST API ([Schema](https://qdrant.github.io/qdrant/redoc/index.html#operation/scroll_points)):
```http
POST /collections/{collection_name}/points/count
{
"filter": {
"must": [
{
"key": "color",
"match": {
"value": "red"
}
}
]
},
"exact": true
}
```
```python
client.scroll(
collection_name="{collection_name}",
scroll_filter=models.Filter(
must=[
models.FieldCondition(
key="color",
match=models.MatchValue(value="red")
),
]
),
exact=True,
)
```
Returns number of counts mathcing given filtering conditions:
```json
{
"count": 3811
}
```
+49 -6
View File
@@ -78,7 +78,7 @@ POST /collections/{collection_name}/points/search
"hnsw_ef": 128
},
"vector": [0.2, 0.1, 0.9, 0.7],
"top": 3
"limit": 3
}
```
@@ -104,12 +104,12 @@ client.search(
hnsw_ef=128
),
query_vector=[0.2, 0.1, 0.9, 0.7],
top=3,
limit=3,
)
```
In this example, we are looking for vectors similar to vector `[0.2, 0.1, 0.9, 0.7]`.
Parameter `top` specifies the amount of most similar results we would like to retrieve.
Parameter `limit` (or its alias - `top`) specifies the amount of most similar results we would like to retrieve.
Values under the key `params` specify custom parameters for the search.
Currently, it could be:
@@ -145,7 +145,7 @@ It will exclude all results with a score worse than the given.
<aside role="status">This parameter may exclude lower or higher scores depending on the used metric. For example, higher scores of Euclidean metric are considered more distant and, therefore, will be excluded.</aside>
### Payload in vector in the result
### Payload and vector in the result
By default, retrieval methods do not return any stored information.
Additional parameters `with_vector` and `with_payload` could alter this behavior.
@@ -229,7 +229,7 @@ POST /collections/{collection_name}/points/recommend
},
"negative": [718],
"positive": [100, 231],
"top": 10
"limit": 10
}
```
@@ -248,7 +248,7 @@ client.recommend(
),
negative=[718],
positive=[100, 231],
top=10,
limit=10,
)
```
@@ -265,3 +265,46 @@ Example result of this API would be
"time": 0.001
}
```
## Pagination
*Avalable since v0.8.3*
Search and recommendation APIs allow to skip first results of the search and return only the result starting from some specified offset:
Example:
```http
POST /collections/{collection_name}/points/search
{
"vector": [0.2, 0.1, 0.9, 0.7],
"with_vector": true,
"with_payload": true,
"limit": 10,
"offset": 100
}
```
```python
client.search(
collection_name="{collection_name}",
query_vector=[0.2, 0.1, 0.9, 0.7],
with_vector=True,
with_payload=True,
limit=10,
offset=100
)
```
Is equvalent to retrieving 11th page with 10 records per page.
<aside role="alert">Large offset values may cause performance issues</aside>
Vector-based retrieval in general and HNSW index in particular, are not designed to be paginated.
It is impossible to retrieve Nth closest vector without retrieving the first N vectors first.
However, using the offset parameter saves the resources by reducing network traffic and the number of times the storage is accessed.
Using an `offset` parameter, will require to internally retrieve `offset + limit` points, but only access payload and vector from the storage those points which are going to be actually returned.
@@ -3,6 +3,8 @@ title: Snapshots
weight: 51
---
*avalable since v0.8.4*
Snapshots are performed on a per collection basis and consist in a `tar` archive file containing the necessary data to restore the collection at the time of the snapshot.
This feature can be used to archive data or easily replicate an existing deployment.